-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🐛 Markdown coloring problem #281
Comments
I notice that I upgraded to 0.4.3, and I still see this behavior. Anything I can do to help? |
Hi @kjmph, thanks! Sorry to be slow, this does clearly look like a bug. It suggests that the highlighter is retaining state between the frag and the code, which should be easy to fix. By the way, do you have anything special configured for your markdown highlighting? I wanted to reproduce your example, but in a very brief attempt I see that bat and delta are only highlighting HTML chunks in markdown files for me. |
Sorry my slow response! I suppose I have ran the For instance: |
@kjmph sorry not to have fixed this yet.... Ok, I've found a way to reproduce this. Here I've captured some diff output and doctored it to have a hunk header ("frag") that will trigger the bug you've reported: diff --git a/README.md b/README.md
index f1db9d6..ddeeff3 100644
--- a/README.html
+++ b/README.html
@@ -14,6 +14,8 @@ <img width=500px src="https://
<img width=500px src="https://user-images.githubusercontent.com/52205/80056404-23745500-84f2-11ea-9ecd-832376faf2f1.png" alt="image" />
</td></tr></table>
+This is a new line
+
If you run emacs as a terminal application (`emacs -nw`) and colors are not being rendered correctly, then follow the instructions here: https://www.gnu.org/software/emacs/manual/html_node/efaq/Colors-on-a-TTY.html. Now feeding that to delta on stdin reproduces it:
Thanks very much; I'll fix this. Incidentally, the reason I wasn't getting detailed markdown highlighting was because my default theme (GitHub, ironically perhaps) doesn't seem to do that. However there is still one thing I'm baffled by: taking delta out of the equation, it seems that your git is giving you hunk headers ("frags") for markdown. But mine is not. For example, with the magit-delta repo at dandavison/magit-delta@b8526f8, I insert a new line like you did, and I don't get a hunk header (I just get
|
This is fixed in master (not released yet). |
Interesting question you posed to me. I tried with a brand new user account (with no configuration), and I still see the hunk header. I tried on macOS and Linux, same deal. The output is mostly the equivalent of using If anything, I followed the attributes gist you linked, and using the diff parser for Markdown removes the hunk header's context. I don't actually know how to answer your question, other than, no.. I don't think I'm doing anything special here. |
Oh, and my apologies, I was so flummoxed by the question; I forgot to say thank you for fixing this. :) |
If we go back in time, we see this was added in git v1.3.0: git/git@acb7257 While it has had a few modifications to date, it is still the default: https://github.com/git/git/blob/bf0a430f70b53f94454692c9ae8ddadd18891aaa/diff.c#L3596 I can see why it is preferred to use git attributes to change the search for the function header, lots more languages out there now.. Yet, any default git config should reproduce this error. |
This is released now (v0.4.5). |
I noticed when delta is used to color Markdown files, it shortens the frag to fit into a fixed width. However, if the frag was a link (which is often the case in Markdown), it messes up the coloring by not stopping the link coloring:
Is there anything else I can supply for this issue?
The text was updated successfully, but these errors were encountered: