-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom magic comments for CodeBlock with raw-loader not working #9129
Comments
PS: I'm opening this as a bug because documentation doesn't mention anything about custom magic comments being unsupported in CodeBlocks with raw-loader. In fact the default magic comment works (highlight-next-line for example). |
If the default magic comments work but not custom ones, it should probably be a bug. Otherwise I was not so sure ^^ |
You are using a shiki preset that is overriding our default code block This shiki preset does not implement magic comments: Please open a new repro without using any third-party plugin/preset, otherwise it can't be considered as a bug in docusaurus core |
@slorber I'm not using the shiki preset for reproducing this issue. The branch I referred to in the example doesn't contain shiki stuff although the repo name. |
I also noticed this issue first in my production website (internal), which doesn't use Shiki, and only after that I created the reproduction repo. |
I can reproduce, minimal repro: https://stackblitz.com/edit/github-ebe6eo-zlw6c8?file=src%2Fpages%2Findex.md It seems related to the This prop overrides the I think it's working as intended: the CSS className is added properly to the line, it's just "ignored" due to styling conflicts. So it's not a magic comments bug but rather a conflict between our theme CSS and your custom CSS, which is hard to avoid, unfortunately. I'd like your custom CSS to automatically override our theme by default: but that belongs to a more general issue about CSS insertion order: #3678 The workaround is simply to use .code-block-hide-line {
display: none !important;
} |
Thanks a lot for the investigation, @slorber. And the workaround works great! |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I think the title says everything. Custom magic comments are working on plain markdown code blocks but not on MDX CodeBlock with raw-loader.
myfile.yaml contents:
Reproducible demo
https://github.com/felipecrs/shiki-docusaurus-test/commit/49e3e8af2021f86df74a122b35c13908b16459c0
Steps to reproduce
Described above.
Expected behavior
To work as it works for plain md code blocks.
Actual behavior
Your environment
No response
Self-service
The text was updated successfully, but these errors were encountered: