Skip to content

Best way to create annotations/comments for code blocks? #10327

Answered by slorber
C-Loftus asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@C-Loftus
Comment options

@slorber
Comment options

slorber Jul 22, 2024
Collaborator

@pomber
Comment options

Answer selected by C-Loftus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants