Closed lukesmurray closed 4 years ago
not as simple as I hoped, extendMarkdownIt does not have access to the currently opened file. So we actually will most likely need to do parsing within the markdownit extension. Will have to pass csldata by reference.
I'm labeling this as out of scope based on #49. I've decided that rendering any form of output is out of scope. The only form of output I want to try and tackle is materializing a workspace for use in pandoc.
This is related to #29 but we can focus on adding file references first, then adding a bibliography. I think the best strategy is to use a position based approach. We have to modify the inline tokenizer so we shouldl look at the link tokenizer from markdownit https://github.com/markdown-it/markdown-it/blob/1093e68e51c9b3104289c3cfbaffbb1fa4039d59/lib/rules_inline/link.js
But we have to use a plugin approach so we can look at the
ins
plugin https://github.com/markdown-it/markdown-it-ins/blob/master/index.jsFrom the link example it looks like
pos
is the offset into the src. We can matchpos
andoffset
from unist point to determine ranges to replace with custom rendering.