diff --git a/__tests__/compilers/compatability.test.ts b/__tests__/compilers/compatability.test.ts
index e016f9d35..71d8c2391 100644
--- a/__tests__/compilers/compatability.test.ts
+++ b/__tests__/compilers/compatability.test.ts
@@ -104,4 +104,20 @@ This is an image:
expect(mdx(rdmd.mdast(md)).trim()).toBe('This is an image: ');
});
+
+ it('compiles escapes', () => {
+ const md = `
+\\- not a list item
+ `;
+
+ expect(mdx(rdmd.mdast(md)).trim()).toBe('\\- not a list item');
+ });
+
+ it('compiles escapes of backslashes', () => {
+ const md = `
+\\\\**still emphatic**
+ `;
+
+ expect(mdx(rdmd.mdast(md)).trim()).toBe('\\\\**still emphatic**');
+ });
});
diff --git a/processor/compile/compatibility.ts b/processor/compile/compatibility.ts
index e7d0c508b..2c717aa71 100644
--- a/processor/compile/compatibility.ts
+++ b/processor/compile/compatibility.ts
@@ -9,6 +9,7 @@ type CompatNodes =
| { type: NodeTypes.glossary; data: { hProperties: { term: string } } }
| { type: NodeTypes.glossary; data: { hName: 'Glossary' }; children: [{ type: 'text'; value: string }] }
| { type: NodeTypes.reusableContent; tag: string }
+ | { type: 'escape'; value: string }
| Html;
/*
@@ -39,6 +40,8 @@ const compatibility = (node: CompatNodes) => {
return `<${node.tag} />`;
case 'html':
return html(node);
+ case 'escape':
+ return `\\${node.value}`;
default:
throw new Error('Unhandled node type!');
}
diff --git a/processor/compile/index.ts b/processor/compile/index.ts
index d094fb978..b687be0eb 100644
--- a/processor/compile/index.ts
+++ b/processor/compile/index.ts
@@ -22,6 +22,7 @@ function compilers() {
[NodeTypes.variable]: compatibility,
[NodeTypes.glossary]: compatibility,
[NodeTypes.reusableContent]: compatibility,
+ escape: compatibility,
html: compatibility,
};