Geany's markdown syntax highlighting (without the markdown plugin) is confused, when image link without title is used: ``` ![](media\image21.png) ``` All the following text is highlighted bold (same as the link itself). ![md1](https://user-images.githubusercontent.com/1393254/109849915-38615f00-7c52-11...) Also the following markdown syntax is ignored - see ```*Obecné*``` is not in italics.
When I fill in some title to image link ``` ![abc](media\image21.png) ``` then the highlighting became correct (i.e. only link itself is bold). ![md2](https://user-images.githubusercontent.com/1393254/109849989-4b742f00-7c52-11...) Also the following markdown syntax is ok then (*```*Obecné*```* **is** in italics).
The correct behavior is to highlight bold only the link even if its title is empty.
The highlighting is provided by the Scintilla project, you should report it there (https://sourceforge.net/projects/scintilla/) so you get notifications if there are questions rather than it being filtered via Geany. You could test it with the latest version of Scite 4.x, the reference editor for Scintilla, since Geany does not use the latest version of Scintilla at the moment, but AFAICT there have been no changes to markdown lexing since the version Geany uses.
Please post a link to the Scintilla bug report here for tracking.
ok, bug filled and accepted on Scintilla: https://sourceforge.net/p/scintilla/bugs/2235/
The common syntax for the Markdown image is `![alt text](src-file)` (see [md-images]).
Not sure if the alt-text should be considered optional by the markdown parser (in HTML it is optional) . Alt-text is useful for textual labeling of the image and used by screen readers too. IIRC, specifying the alt-text is indeed considered a best practice.
[md-images]: https://daringfireball.net/projects/markdown/syntax?spm=a2c65.11461447.0.0.6...
@nomadbyte the [Comon Mark](https://spec.commonmark.org/0.29/) spec which has replaced Gruber as the reference for Markdown says "A link text consists of a sequence of zero or more inline elements enclosed by square brackets ([ and ]).", zero, so its allowed to be empty.
Is Common Mark what Scintilla uses for Markdown spec in their implementation?
The Scintilla lexer is quite old, predating Commonmark, so I suspect it uses a bit of a mixture of the various "flavours" of Markdown that have developed over time, thats the problem with Markdown and the reason for Commonmark to attempt to bring them together.
Remember highlighting lexers are not syntax checkers, they should work on as many variants of a language as possible, and even work on illegal code so as to highlight whilst the user is still typing.
In pandoc version of markdown, empty text is not only legal, but serves to distinguish paragraph images (not labeled, not indented and not automatically numbered) from figures.
I agree that syntax highlighters should work on as many variants as possible.
github-comments@lists.geany.org