-
Notifications
You must be signed in to change notification settings - Fork 6
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
Invalid HTML tag in hover response #60
Comments
I'm happy to find a way to accommodate this, but arguably our behavior is correct. The snippet The angle brackets syntax for hyperlinks is standard markdown, see this. Could it be that the space is confusing Sublime? You could test this by hovering over the |
PS: Did you need to do anything nontrivial to configure the server on Sublime? I'd be happy to add some instructions to the README or a link to some other place. |
Oh, I totally forgot about autolinks in Markdown. I agree that it should be valid and recognized as a hyperlink. I think the space in the But the space is not the reason why the link conversion fails. The Sublime client uses a mdpopups dependency to convert Markdown to HTML, which in turn uses Python-Markdown. It seems that Python-Markdown can't handle autolinks with arbitrary schemes: pip install markdown >>> import markdown
>>> markdown.markdown('<http://foo.bar.baz>')
'<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p>'
>>> markdown.markdown('<info:latex2e#array>')
'<p><info:latex2e#array></p>' I found the related issue Python-Markdown/markdown#1244, and from reading that it seems that preserving autolinks with unknown schemes as raw HTML is the intended behavior 🙄. So if we want to mitigate the broken popups in Sublime Text, possible solutions could be
But since this is not really a bug in the server, feel free to close this issue.
I use the following configuration for the LSP client in Sublime Text (LSP.sublime-settings): {
"clients": {
"digestiff": {
"enabled": true,
"command": ["digestif"],
"selector": "text.tex.latex"
},
}
} Sublime Text prevents autocomplete in LaTeX files by default, and in order to have autocompletion to work you need to manually adjust the "auto_complete_selector" setting in Sublime's settings (Preferences.sublime-settings). I currently use {
"auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc, text.tex constant.other.citation, text.tex constant.other.reference, text.tex variable.parameter.function, text.tex support.function",
} which should enable completions for the relevant situations in LaTeX (commands, environment names, etc., but not plain text). The installation of a recent Lua version and luarocks on Windows was a bit of pain though. For instructions in the README, you could add ### Sublime Text with the [LSP](https://packagecontrol.io/packages/LSP) package
See instructions [here](https://lsp.sublimetext.io/language_servers/#digestif). where the latter link does not yet exist, but I can add it later. (The reason is that there might possibly be a LSP-digestif helper package for Sublime Text some time in the future, which could simplify installation & updates. But probably not in the short term, because Sublime's LSP framework doesn't have automated support for Lua server implementations at the moment.) |
Great, thanks for the pointers. Then I think I'll change the markdown link to As to Sublime, if you want to add the info the non-existing link, then I'll add your suggestion to the README. Just let me know! |
Thanks, yes the regular Markdown link format should be sufficient. By the way, the instructions link is ready now: https://lsp.sublimetext.io/language_servers/#digestif |
Okay, I pushed some changes to the info link rendering, let me know if it improves the situation.
Thanks a lot, I'll add a link to the readme soon. |
I tried this language server in Sublime Text and I like it so far.
But I noticed that popups on mouse hover look broken, because the hover response from the server contains an unclosed and invalid HTML-tag
<info:latex2e# [...] >
. Sublime Text uses a custom HTML rendering engine for its hover popups, and so the Markdown content has to be converted to HTML by the client. Since HTML tags (including custom tags) are valid within Markdown, they are preserved when converting to HTML. However, Sublime Text can't handle unclosed custom tags, and afaik:
and#
are also invalid characters in tag names (see https://github.github.com/gfm/#tag-name).Here is an example of the server response when I hover over the
\LaTeX
macro:The popup cuts off after the first list item:
It would be nice if this HTML tag could be removed from the Markdown content, assuming it serves no purpose. In case it should be rendered literally, please consider to replace
<
by<
.The text was updated successfully, but these errors were encountered: