Skip to content

Commit

Permalink
feat: add showLineNumbers option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 5, 2022
1 parent 615b448 commit 4191f97
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/markdown-to-html/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ export interface Options {
hastNode?: boolean;
/** Rewrite Element. [rehype-rewrite](https://github.com/jaywcjlove/rehype-rewrite#rewritenode-index-parent-void) */
rewrite?: RehypeRewriteOptions['rewrite'];
/** code blocks show line numbers. @default `true` */
showLineNumbers?: boolean;
}

function markdown(markdownStr: string = '', options: Options = {}) {
const { filterPlugins } = options;
const { filterPlugins, showLineNumbers = true } = options;
const remarkPlugins: PluggableList = [remarkGfm, ...(options.remarkPlugins || [])];
const rehypePlugins: PluggableList = [
rehypeVideo,
[rehypePrism, { ignoreMissing: true, showLineNumbers: true }],
[rehypePrism, { ignoreMissing: true, showLineNumbers }],
rehypeRaw,
[rehypeAttrs, { properties: 'attr', codeBlockParames: false }],
rehypeIgnore,
Expand Down

0 comments on commit 4191f97

Please sign in to comment.