Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(editor): only treat ~~ as strikethrough so single-tilde prose survives

Sergey Kozyrenkof25c26d7d5a4
diff --git a/frontend/src/components/shared/editor-markdown.ts b/frontend/src/components/shared/editor-markdown.ts
index b00978e0..09fd71b5 100644
--- a/frontend/src/components/shared/editor-markdown.ts
+++ b/frontend/src/components/shared/editor-markdown.ts
@@ -13,7 +13,16 @@ import { Marked } from 'marked';
const createFaithfulMarked = () => {
const instance = new Marked();
- instance.use({ tokenizer: { html: () => undefined, tag: () => undefined } });
+ instance.use({
+ tokenizer: {
+ // GFM strikethrough is `~~text~~`; marked also treats a single `~text~` as <del>, which mangles
+ // prose such as `from ~5~ to ~10~` into strikethrough. Defer real `~~` to the default tokenizer
+ // and neutralise a lone `~…~` so it stays literal text.
+ del: (src: string) => (/^~~(?!~)/.test(src) ? false : undefined),
+ html: () => undefined,
+ tag: () => undefined,
+ },
+ });
// A PRIVATE instance — mutating the shared global `marked` would also affect report-pdf.
return instance;
diff --git a/frontend/src/components/shared/markdown-editor-extensions.test.ts b/frontend/src/components/shared/markdown-editor-extensions.test.ts
index f9f2f019..204c6da0 100644
--- a/frontend/src/components/shared/markdown-editor-extensions.test.ts
+++ b/frontend/src/components/shared/markdown-editor-extensions.test.ts
@@ -63,15 +63,19 @@ describe('selective escape — no stray backslashes on literal punctuation', ()
);
});
-describe('lone tilde stays literal — no stray backslash injected (M1)', () => {
- it.each(['~10% for environment setup', 'approximately ~5 minutes', 'a ~ b ~ c'])(
- 'keeps %s byte-identical',
- (s) => {
- expect(roundTrip(s)).toBe(s);
- },
- );
+describe('single tildes stay literal — no over-escape, no accidental strikethrough', () => {
+ it.each([
+ '~10% for environment setup',
+ 'approximately ~5 minutes',
+ 'a ~ b ~ c',
+ 'from ~5~ to ~10~',
+ 'price ~5~ dollars',
+ 'path a~b~c here',
+ ])('keeps %s byte-identical', (s) => {
+ expect(roundTrip(s)).toBe(s);
+ });
- it('still round-trips ~~strikethrough~~ (double tilde unaffected)', () => {
+ it('still round-trips ~~strikethrough~~ (double tilde is GFM strike)', () => {
expect(roundTrip('use ~~deprecated~~ here')).toContain('~~deprecated~~');
});
});