-
I am working on documenting a config file where I want to add comments to each line without actually adding them in the file or putting it all in a paragraph / table after the code block. It would be awesome if there was a way to show the comments next to or above the line by hovering the line or clicking a button would be great. This is doable in quarto and a brief example can be found here: https://quarto.org/docs/authoring/code-annotation.html What is the recommended way of doing this in Docusaurus? It appears the feature request had some discussion but I am unclear if anything came of it. I know you can swizzle components but I am not sure if there is an easier way or if anyone has accomplished this previously. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
We don't provide that feature out of the box. The possible ways to implement that are through a remark/rehype plugin (only works in Markdown code blocks), or by swizzling the CodeBlock component, or by creating your own custom code block component to replace the code block component we use for Markdown code blocks ( I agree this feature would be useful, but it can be implemented in userland. If someone implements it first in userland, and the implementation is successful, we might as well merge it back in Docusaurus. |
Beta Was this translation helpful? Give feedback.
We don't provide that feature out of the box.
The possible ways to implement that are through a remark/rehype plugin (only works in Markdown code blocks), or by swizzling the CodeBlock component, or by creating your own custom code block component to replace the code block component we use for Markdown code blocks (
@theme/CodeBlock
).I agree this feature would be useful, but it can be implemented in userland. If someone implements it first in userland, and the implementation is successful, we might as well merge it back in Docusaurus.