Skip to content

Commit

Permalink
refactor(entry_converter): remove usage of rehype
Browse files Browse the repository at this point in the history
  • Loading branch information
kubosho committed Jul 22, 2024
1 parent e8bc7f1 commit 694a45b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/app/entry/entry_converter.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import rehypePrism from '@mapbox/rehype-prism';
import html from 'rehype-stringify';
import breaks from 'remark-breaks';
import gfm from 'remark-gfm';
import markdown from 'remark-parse';
import remarkToRehype from 'remark-rehype';
import html from 'remark-html';
import parse from 'remark-parse';
import stringify from 'remark-stringify';
import strip from 'strip-markdown';
import { unified } from 'unified';

const markdownProcessor = unified().use(markdown).use(gfm);
const markdownProcessor = unified().use(parse).use(gfm);

export async function convertMarkdownToHtml(markdownText: string): Promise<string> {
const processor = markdownProcessor()
.use(breaks)
.use(remarkToRehype, { allowDangerousHtml: true })
.use(rehypePrism, { ignoreMissing: true })
.use(html, { allowDangerousHtml: true });
const processor = markdownProcessor().use(breaks).use(html, { sanitize: false });

return (await processor.process(markdownText)).value.toString();
}
Expand Down

0 comments on commit 694a45b

Please sign in to comment.