Skip to content

spaces added to popup message breaks markdown formatting #2

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

Open
dlyongemallo opened this issue Jun 14, 2024 · 2 comments
Open

spaces added to popup message breaks markdown formatting #2

dlyongemallo opened this issue Jun 14, 2024 · 2 comments

Comments

@dlyongemallo
Copy link

In particular, this line adds a space before and after each line of the popup message.

The result is this (note that EOL whitespace is highlighted):
Screenshot from 2024-06-14 09-31-37

These added spaces break markdown syntax detection. Removing the above line results in:
Screenshot from 2024-06-14 09-32-14

This is slightly better as at least the markdown syntax highlighting is being applied. This could be improved further by annotating the code blocks as Rust:

Screenshot from 2024-06-14 09-32-47

Finally, making the title into a markdown heading and setting the conceallevel to 2, we get this much nicer output:

Screenshot from 2024-06-14 09-33-20

@yining
Copy link
Owner

yining commented Jun 18, 2024

Hi @dlyongemallo,

Thanks for raising the issue, and sorry for the late reply.

I will push a commit for the fix soon.

@dlyongemallo
Copy link
Author

For annotating the code blocks, rustc seems not to have that as an output option, but I've implemented a workaround (from here):

Put this in a script:

#!/bin/bash

if [ "$1" = "--explain" ]
then
    shift
fi
if [ "$1" = "" ]
then
    echo "Usage: $0 <error code>"
    exit 1
fi
rustc --explain "$1" | sed '/^```/{s//&rust/;:a;n;//!ba}'

Then set rustcexplain_rustc_bin to point to this script.

yining added a commit that referenced this issue Jun 18, 2024
- mark code blocks as `rust` before sending content to popup window;
- in neovim, set the local `conceallevel` to `2` in the popup window,
  did not find the equivalent in vim (please help pointing out if there
  is any);
- mark the content title as level one header
- remove the trailing white spaces if in neovim, those spaces were
  meant to be used as padding as popup window lacks padding option in
  neovim, remove them for now;
- add tests for the function that mark code blocks as `rust`

Ref: [issue 2](#2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants