Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions __tests__/compilers/html-block.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { mdast, mdx } from '../../index';

describe('html-block compiler', () => {
it('compiles html blocks within containers', () => {
const markdown = `
> 🚧 It compiles!
>
> <HTMLBlock>{\`
> <strong style="color: olive">Hello, World!</strong>
> \`}</HTMLBlock>
`;

expect(mdx(mdast(markdown)).trim()).toBe(markdown.trim());
});

it('compiles html blocks with indents', () => {
const markdown = `
<HTMLBlock>{\`
<pre><code>
const foo = () => {
const bar = {
baz: 'blammo'
}

return bar
}
</code></pre>
\`}</HTMLBlock>
`;

expect(mdx(mdast(markdown)).trim()).toBe(markdown.trim());
});
});