Comments (11)
So it's the LSP server that's sending mangled content? In that case I might consider raising the issue there.
Thanks for looking into this!
from eldoc-box.
Do you just recently start to see these? I can easily fix this but I want to make sure recent changes aren't breaking something that I'm not aware of.
from eldoc-box.
I only started using eglot yesterday (been using lsp-mode until now), so I can't tell if they are recent or older.
from eldoc-box.
The
codes are gone, thanks!
Since you mention people should file issues if they find things that can be prettified, I hope you don't mind if I report a few more issues. Completely up to you to decide if you want to do something about them, of course. They are not as conspicuous as the
thing, so I'm a happy camper either way.
- Some characters appear with backslash escapes. These seem to be characters that have a special meaning in Markdown: the ones I'm seeing are underscore and asterisk.
- double underscore at the end of some lines. (This might be a fontification effect of
markdown-mode
, because that's how it signals a double space at the end of a line, although in the actual doc string, there are no double spaces.) - Emoji shortcodes aren't rendered. In the doc string, they are written
``+1``
and``:sunglasses:``
, and they should probably be rendered that way. (BTW, emoji are otherwise displayed just fine, so I assume it's not a font issue.)
FWIW, here is the doc string as found in the source code:
"""Display string formatted as Markdown.
Parameters
----------
body : str
The string to display as Github-flavored Markdown. Syntax
information can be found at: https://github.github.com/gfm.
This also supports:
* Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
For a list of all supported codes,
see https://share.streamlit.io/streamlit/emoji-shortcodes.
* LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
must be on their own lines). Supported LaTeX functions are listed
at https://katex.org/docs/supported.html.
* Colored text, using the syntax ``:color[text to be colored]``,
where ``color`` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
unsafe_allow_html : bool
By default, any HTML tags found in the body will be escaped and
therefore treated as pure text. This behavior may be turned off by
setting this argument to True.
That said, we *strongly advise against it*. It is hard to write
secure HTML, so by using this argument you may be compromising your
users' security. For more information, see:
https://github.com/streamlit/streamlit/issues/152
Examples
--------
>>> import streamlit as st
>>>
>>> st.markdown('Streamlit is **_really_ cool**.')
>>> st.markdown(”This text is :red[colored red], and this is **:blue[colored]** and bold.”)
>>> st.markdown(":green[$\sqrt{x^2+y^2}=1$] is a Pythagorean identity. :pencil:")
"""
from eldoc-box.
I only started using eglot yesterday (been using lsp-mode until now), so I can't tell if they are recent or older.
Ah, then it makes sense, very good.
Since you mention people should file issues if they find things that can be prettified, I hope you don't mind if I report a few more issues. Completely up to you to decide if you want to do something about them, of course. They are not as conspicuous as the thing, so I'm a happy camper either way.
Yes, reports are very welcome. And thank you for your detailed reports!
The report clearly went through some processing before displayed by eldoc-box, could you run M-x eldoc-doc-buffer
and copy the content of this buffer to here? Also the content of Eglot's event buffer (opened by eglot-events-buffer
), if you can. The events buffer will be very large so maybe save it into a file.
from eldoc-box.
BTW, as a user, do you prefer monospace or sans serif for eldoc-box's documentation?
from eldoc-box.
eldoc-doc-buffer
:
```python
(variable) markdown: (body: SupportsStr, unsafe_allow_html: bool = False) -> DeltaGenerator
```
---
Display string formatted as Markdown.
Parameters
----------
body : str
The string to display as Github-flavored Markdown. Syntax
information can be found at: https://github.github.com/gfm.
This also supports:
* Emoji shortcodes, such as `` and ``.
For a list of all supported codes,
see https://share.streamlit.io/streamlit/emoji-shortcodes.
* LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
must be on their own lines). Supported LaTeX functions are listed
at https://katex.org/docs/supported.html.
* Colored text, using the syntax `:color[text to be colored]`,
where `color` needs to be replaced with any of the following
supported colors: blue, green, orange, red, violet.
unsafe\_allow\_html : bool
By default, any HTML tags found in the body will be escaped and
therefore treated as pure text. This behavior may be turned off by
setting this argument to True.
That said, we \*strongly advise against it\*. It is hard to write
secure HTML, so by using this argument you may be compromising your
users' security. For more information, see:
https://github.com/streamlit/streamlit/issues/152
Examples
--------
```
>>> import streamlit as st
>>>
>>> st.markdown('Streamlit is **_really_ cool**.')
>>> st.markdown(”This text is :red[colored red], and this is **:blue[colored]** and bold.”)
>>> st.markdown(":green[$\sqrt{x^2+y^2}=1$] is a Pythagorean identity. :pencil:")
```
I put eglot-event-buffer
in a gist: https://gist.github.com/joostkremers/a809060209255a822ce758b6c7ecd933
eldoc-doc-buffer
is also in the gist, just in case.
What you cannot easily see from this is that the double underscore after str
and bool
are indeed double spaces fontified by markdown-mode
. (I checked with C-u C-x =
.) If you select the text above, you'll notice that there are two spaces. They do not exist in the original doc string.
from eldoc-box.
BTW, as a user, do you prefer monospace or sans serif for eldoc-box's documentation?
I definitely prefer monospace, for the superbly objective reason that it's an editor, darn it, and editors should use monospace! 😄
Actually, I do use sans serif in Emacs, primarily in text (markdown) buffers, but documentation is code-related, and for me, that means monospace. But that's just my €0.02, of course.
from eldoc-box.
Ok, I can fix the underlined spaces but not the backslashes and disappearing emojis.
The backslash is too unspecific. Eldoc-box can receive plain text or markdown, so it can't be sure that a backslash is a markdown escape rather than a plain backslash. The backslash is best handled in markdown-mode, which eglot uses to render the markdown doc.
The emoji are stripped out for some reason even before python LSP sends the doc to eglot (judging by the eglot events log), so there aren't anything we can do.
from eldoc-box.
I think so, look at line 375 in eglot-events-buffer.txt:
...* Emoji shortcodes, such as `` and ``.\n...
from eldoc-box.
Yes, I noticed those, too. Just wasn't sure what it meant, i.e., if that's literally what the LSP server sends or if it had already been modified by eglot.
from eldoc-box.
Related Issues (20)
- The eldoc-box-frame-hook might be broken and how to draw a border around the child frame HOT 6
- Multiple overlapping child frames HOT 1
- consider pop the posframe over the edit line?
- Initial eldoc-box child frame size too small--second time corrects itself
- eldoc-box overlapping with company-box HOT 7
- Typos in README HOT 1
- Using Only Help at Point HOT 6
- Code Background in Eldoc Box Frame HOT 2
- Update the README Notes HOT 1
- how to disable "embark on _____" messages from appearing HOT 2
- `C-g` does not kill the frame created by `eldoc-box-help-at-point` HOT 3
- Tab-bar enabled incorrectly on childframe
- Is it possible to choose which eldoc-documentation-functions are applied when displaying the documentation? HOT 2
- When using eldoc-box-hover-at-point-mode can't scroll child frame HOT 3
- eldoc-box-help-at-point not displaing the correct docs HOT 4
- Is it possible to target the child frame?
- Upstream plans
- Manually trigggering eldoc-box-help-at-point will often show previous/outdated docs HOT 11
- Child-frame partially off-screen in `eldoc-box-hover-mode` HOT 2
- Support as front-end for corfu or company-mode candidates? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eldoc-box.