Is there a way to append metadata string to code blocks? #724
-
BackgroundFor my Docusaurus website, https://lfi.dev, I'm using I've built a feature for my website where I can add the meta string And you can see how they render here: GoalI would like to add "Open in Playground" buttons to all the code blocks in my TSDocs. Current ApproachOf course, one way I could do that is by adding Future Approach?Is there a way I could append a metadata string to all code blocks as a step in the markdown generation? If not, then this might not be a big deal and I can probably just include Thanks in advance :) EDIT: I found out about
Just causes Typedoc to complain about |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@TomerAberbach apologies for delayed reply. This could be achieved with remark. Unfortunately there was a bug in docusaurus-plugin that was preventing the remark plugin being loaded properly but that is fixed now. I have a working example here - https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/tree/main/issues/724. This example isn't running with Docusaurus, but I have also tested with Your config would look something like this:
As an alternative to the above you could also parse content as a string and use regex to achieve similar by listening to TypeDoc page events as per https://www.typedoc-plugin-markdown.org/api-docs/Document.Customizing-Output#page-events . Hope this helps. :) |
Beta Was this translation helpful? Give feedback.
@TomerAberbach apologies for delayed reply.
This could be achieved with remark. Unfortunately there was a bug in docusaurus-plugin that was preventing the remark plugin being loaded properly but that is fixed now.
I have a working example here - https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/tree/main/issues/724. This example isn't running with Docusaurus, but I have also tested with
docusaurus-plugin-typedoc@1.1.1
.Your config would look something like this:
docusaurus.config.js
remark-add-playground.mjs