0

First of all, apologies for posting a slightly vague non-code-specific question but I’ve been reading through the documentation all day and can’t wrap my head around this.

I’m using next-mdx-remote and trying to make a remark plug-in that will look for specific strings (defined in an array in JavaScript) and wrap them in a span.

The typical workflow is you target existing markdown characters like # for heading and specify how you’d like them handled. In my case the target string could be inside a P, or a heading, anywhere there is text (but shouldn’t affect URLs and images).

I’ve been using the AST visit crawler, and I can target P tags for example, but I can’t seem to split the string into it’s own component that can be treated differently to the rest of the P tag.

I’m trying to do this so I can attach a tooltip to these spans that reads from a glossary array.

I figured I’d ask if anyone knows if this is possible with Remark plugins to save me going round in circles - would really appreciate the help!

whytheq
  • 34,466
  • 65
  • 172
  • 267
Sam
  • 1
  • 2

0 Answers0