Custom Markdown Parsing Question

I’ve been trying to figure out how to piggy back off of the code markdown plug & extend/replace some of the rendering features (I want to justify tables using the standard :-:, :- syntax).

I’ve followed that the general steps are:

  1. the syscall markdown.markdownToHtml gets made
  2. the core markdown plug listens to that with the plug yaml:
  markdownToHtml:
    path: api.ts:markdownToHtml
    syscall: markdown.markdownToHtml
  1. markdownToHtml calls parseMarkdown and renderMarkdownToHtml

But I just can’t seem to get even a simple console logging function to work

// tables.ts
export function testing(
	markdown_string: string,
	options: any
) {
	console.log(markdown_string);
	console.log(options);
}
  testing:
    path: tables.ts:testing
    syscall: markdown.markdownToHtml

There’s something obvious I’m missing here, but I have no clue what it is

You cannot extend the markdown parser through plugs, what you’re doing here is overriding the markdown.markdownToHtml syscall with your own implementation which likely won’t do anything than break things :wink:

If you want to extend the parser there’s no other way than to make changes in the SB core: silverbullet/common/markdown_parser at main · silverbulletmd/silverbullet · GitHub

1 Like