markdown-mode
markdown-mode copied to clipboard
Visually inconsistent text markup / font style
Visually inconsistent text markup / font style
Using the same syntax for different elements on a list, the fonts weight or style is rendered differently.
Expected Behavior
Visually consistent font weight color / style.
Actual Behavior
Different font style / color for the elements on a list, using the same syntax for each.
Steps to Reproduce
Make a list of different elements under the same hierarchical indentation:
- This is element n° 1:
code snippet goes here - This is element n° 2:
code snippet goes here - This is element n° 3:
code snippet goes here - This is element n° 4:
code snippet goes here
Image:

Not a show-stopper, but still strange to look at.
- Markdown Mode: 20180731.1830
- Emacs: 26.1 (although this has happened since emacs24 and emacs25)
- OS: Linux, Ubuntu 16.04, kernel 4.4.0-133
Is there anything I can do to help debug this? Just let me know.
Yes, sorry, I haven't had much free time to dedicate to markdown-mode in a while. If you are able to narrow it down or find a patch that doesn't break any existing tests then that would definitely help. I would start with markdown-match-code. It looks like it is having trouble matching across lines in your example (which is difficult in general for Emacs font-lock). There is a great package called font lock studio that might also help. There are a ton of font lock rules in markdown-mode, so you could disable (comment out) irrelevant ones to make stepping through them faster.
No worries.

I cannot reproduce. Does this issue still happens ?
I cannot reproduce. Does this issue still happens ?
It does happen randomly with long lists of text + code markup; a 4-element list is just an example, but the issue occurs when dealing with about 200 elements.
Here's another example:
Check lines 286 and 287, how the commands between backticks are correctly highlighted, and line 289 isn't, but lines 290 and 291 are inversely highlighted, line 295 is correctly highlighted again, and line 296 is inversely highlighted.

Could you show us raw text instead of the screenshot ? It's hard to type.
This happens to me for even very simple examples.
It is as if randomly only some parts are colored.
By doing small modifications, like adding a whitespace and then removing it, I get coloring to refresh and it turns out in some other state this time.
For example, here I managed to get three different colorings for this file (none of them completely correct) by just adding and removing lines to the file (always ending up at the same state). So I would add and remove the empty line, and I get different coloring:
Here is the example I used:
- `:%s/query/new/gc`
- `g r m` -> make all cursors
- `g r q` -> delete all cursors
- `g w` -> evil fill -> needs motion
This doesn't happen just for backticks, it also happens for example for bold text : **text** -> sometimes it gets bolded, sometimes it doesn't. For URLs also [link](https://test.com).
On following photo bold works but URL and backticks don't.
This is happening on Archlinux, emacs 29.1, spacemacs, markdown-mode 2.7-alpha.
Minor modes enabled in this buffer: Anzu Auto-Save Company Eldoc Emoji-Cheat-Sheet-Plus-Display
Evil-Local Evil-Mc Evil-Surround Font-Lock Hl-Todo Spacemacs-Leader-Override Subword Undo-Tree
Vi-Tilde-Fringe Yas
I tried turning off all modes except for Font-Lock and Spacemacs-Leader-Override and it didn't help, problem is still here.