Closed m-fonseca closed 3 years ago
Hey Marco! You're finding a lot of things related to the *
character :sweat_smile:. The asterisk is used for multiple things in markdown such as italic e.g. *italic*
and list items: * list item
. Markdown does not have a strict spec about this unfortunately.
The reason you're seeing syntax highlight glitches is because again, the syntax highlighter thinks you're trying to italicize text.
This happens because you typed /*
. This is also not something that mkdx handles but rather vim-markdown.
Since you use asterisks in ways that the syntax highlighter and my plugin don't like you may like this trick: try escaping them with a \
e.g. /\*
will fix your syntax highlighting and pressing enter in a (nested) list will also work again. This should also just show /*
in the rendered HTML output.
One last thing, hitting enter after test2 should not create 1.1.1 but rather 1.2 :) As usual cheers for the feedback :+1:, if anything sounds harsh here, know that it is not intended!
As for this issue, I'll leave it open until you've read it and had a chance to reply, feel free to close it if you agree this is an alright solution as well.
So if your wondering to yourself what the heck I'm doing with the markdown, I have some preprocessor directives in it (c sytle, hence /*
). This also makes the workaround you mentioned not possible for me. I've expect some syntax problems and what not because of this, but I guess I didn't expect it to throw of the whole file, so at this point I guess is more of a question of robustness with funny markdown :).
A couple of questions/things that don't make sense to me though, if you will so indulge:
/*
is a multi-line type of statement, then why doesn't all the syntax highlighting below it reflect that. Thats one of the reasons this threw me. /*
can be way above the numbered list, and you don't realize there is a problem because the syntax highlighting is fine until you get to the nested list./*
mode.*
alone without the /
not cause this problem? e.g. instead of /*
If I have a some text is fine *
Either way, this sounds like a vim-markdown issue. So I will close.
Right you are about the 1.2 vs 1.1.1 :)
Oke I understand the asterisk issues a little bit better now since you've clarified these are preprocessor directives. As for your questions/misc things:
/*
then the list item styling will also stick around and overwrite the /*
styles. Custom/preprocessor syntax within markdown is always a bit tricky, though it can be contained within tag delimiters such as <directive a="b"></directive>
for example.*
it is not treated as ['markdownItalic', markdownItalicDelimiter']
highlight but as []
(no highlight). When it's just a *
you need to type a character before it becomes ['markdownItalic', markdownItalicDelimiter']
so for example, *a
also breaks since it highlights as italic.Hope this clarifies things a bit, I might check out enter handler to see if I can improve it but not sure if it's really necessary if that highlight can be fixed instead.
OS type:
Vim:
Vim version: NVIM v0.5.0-dev+1211-g6db3ba9df
Using mkdx 186cf8c
Reproduce steps:
Using
Hitting enter after test2 does not create a numbered list automatically. This also happens on checkboxes. The key is they have to be nested and there has to be a / in there above it. I don't know what it doesn't like about '/' but it throws things off (syntax highlighting also is changed).
Expected:
Hitting enter after test2 should auto create 1.1.1
Actual:
It doesn't create 1.1.1
Marco