kevins8
05/26/2021, 10:22 PM<a>...</a>
tag into <p>...</p>
i would try rendering it as a rehype node directly when compiling for html. see an example of it here -> https://github.com/landakram/remark-wiki-linkkevins8
05/26/2021, 10:30 PMhikchoi
05/26/2021, 10:55 PMkevins8
05/26/2021, 11:03 PMhikchoi
05/26/2021, 11:03 PMSeriousBug
05/27/2021, 3:52 AMfunction attachCompiler(proc: Unified.Processor, opts?: PluginOpts) {
const Compiler = proc.Compiler;
const visitors = Compiler.prototype.visitors;
debugger;
if (visitors) {
visitors.blockAnchor = function (node: BlockAnchor): string | Element {
debugger;
I'm hitting the first break point, but never the second one. I tried outputting a hast node directly, but it doesn't really matter because the function doesn't even get called.kevins8
05/27/2021, 4:27 AMcompiler
only gets called when its compiling the corresponding node type. because we are calling remark2rehype
, the node type gets converted to a rehype
node which is why the compiler never calls it.
we use a transformer, dendronPub
(https://github.com/dendronhq/dendron/blob/dev-kevin/packages/engine-server/src/markdown/remark/dendronPub.ts#L157:L157), which runs after parsing but before compilation to transform the remark nodes into rehype nodes.SeriousBug
05/27/2021, 4:28 AMkevins8
05/27/2021, 4:29 AMdendronPub
which takes an anchor and converts it into the corresponding html output. you can see tests for it here: https://github.com/dendronhq/dendron/blob/dev-kevin/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts#L101:L101SeriousBug
05/27/2021, 6:52 AMkevins8
05/27/2021, 8:43 PMhikchoi
05/27/2021, 8:44 PMkevins8
05/27/2021, 9:20 PMkevins8
05/27/2021, 9:20 PMkevins8
05/27/2021, 9:20 PMhikchoi
05/27/2021, 9:24 PMSeriousBug
05/27/2021, 9:24 PMhikchoi
05/27/2021, 9:25 PMuser
05/27/2021, 9:30 PMuser
05/27/2021, 9:30 PMhikchoi
05/27/2021, 9:33 PMkevins8
05/27/2021, 9:48 PMhikchoi
05/27/2021, 9:48 PMhikchoi
05/27/2021, 9:49 PMhikchoi
05/27/2021, 9:49 PMkevins8
05/27/2021, 9:53 PMhikchoi
05/27/2021, 9:59 PMcodefriar
05/28/2021, 2:17 PMhikchoi
05/28/2021, 2:46 PMcodefriar
05/28/2021, 2:48 PM