@twinkleplop/markdown-it
v0.1.5
Published
Highlight fenced code and inline code in [markdown-it](https://github.com/markdown-it/markdown-it).
Readme
@twinkleplop/markdown-it
Highlight fenced code and inline code in markdown-it.
import markdown_it from "markdown-it";
import markdown_it_twinkleplop from "@twinkleplop/markdown-it";
import { language as typescript } from "@twinkleplop/typescript";
const md = markdown_it().use(markdown_it_twinkleplop, {
languages: { ts: typescript(), js: "ts" },
});
md.render(source);The plugin replaces the fence renderer rule, and the code_inline rule
when inline code is enabled. Fences without a language use the previous renderer rule when default_language is unset. The plugin does not use markdown-it's highlight option.
Indented code blocks are parsed under markdown-it's own code_block rule,
which the plugin leaves unchanged. Here, default_language applies only to fences. In rehype and remark it also applies to indented blocks.
Errors include the line number and, when env.path is set, the file path:
md.render(source, { path: "docs/guide.md" });See @twinkleplop/markdown-core for shared options, fence metadata and HTML output.
