-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
[Bug] Notation
transfomers remove empty annotated lines
#589
Comments
Notation
transfomers removes empty annotated linesNotation
transfomers remove empty annotated lines
This is intentional and expected behavior. I am ok with exposing an option to toggle that, pr welcome |
Thanks for the reply. It feels a little unexpected since the How would you indicate a diff that includes a new line as part of the code change? |
I guess it's not well-documented. It was migrated from https://github.com/innocenzi/shiki-processor and I kept the original behavior. You can do |
Thanks, that gets me across the line for now. I still think that this is probably still a bug since it is doing the opposite of what the notation comment is suggesting it will. Combined with the I'd like to suggest that an option to toggle is added, but the default behavior be that it just does what the comment says it will. I'm happy to submit a PR. |
Small follow-up to document behavior. The multi-line notation |
see shikijs/shiki#589 Signed-off-by: Lachlan Heywood <lachieh@users.noreply.github.com>
see shikijs/shiki#589 Signed-off-by: Lachlan Heywood <lachieh@users.noreply.github.com>
see shikijs/shiki#589 Signed-off-by: Lachlan Heywood <lachieh@users.noreply.github.com>
see shikijs/shiki#589 Signed-off-by: Lachlan Heywood <lachieh@users.noreply.github.com>
see shikijs/shiki#589 Signed-off-by: Lachlan Heywood <lachieh@users.noreply.github.com>
Hey @rishi-raj-jain, that is not the same issue as this one and it is probably not shiki that is responsible for that extra line. It's probably whatever you're using for markdown processing. I have tested it in an example and the output looks like this: <code>
<span class="line">
<span style="color:#B8A965">cd</span>
<span style="color:#C98A7D"> my-app</span>
</span>
<span class="line">
<span style="color:#80A665">npm</span>
<span style="color:#C98A7D"> run dev</span>
</span>
</code> As a fix, you could add this to your css which will hide the span if it is the last child and it has nothing in it: span.line:last-child:empty {
display: none;
} If you still believe it is a problem with shiki, I'd suggest creating a minimal reproducible example of your own and posting a new issue. |
Hey @lachieh, Thank you for your quick informative response! I was searching for the empty lines issue and this is the closest thread I could find. Pardon the inconvenience caused 🙏 |
Validations
Describe the bug
It seems that all of the notation transformers like
transformerNotationHighlight
andtransformerNotationDiff
that if the line is empty, thespan.line
is removed entirely.For example, the following code run through
codeToHtml
:Results in:
But I would assume it should be:
Reproduction
https://stackblitz.com/edit/vitejs-vite-axpred?file=main.js
Contributes
The text was updated successfully, but these errors were encountered: