Skip to content
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

Short dash cannot be correctly rendered in yaml code. #4171

Closed
lxzxl opened this issue Dec 16, 2017 · 6 comments
Closed

Short dash cannot be correctly rendered in yaml code. #4171

lxzxl opened this issue Dec 16, 2017 · 6 comments
Labels

Comments

@lxzxl
Copy link

lxzxl commented Dec 16, 2017

Hugo is an excellent tool but I got a problem about "-" in yaml code when it's inside of a list item. It seems that Hugo parses the short dash as a markdown list while it should be a yaml's list.

image

which result:

image

Thanks.

@digitalcraftsman
Copy link
Member

digitalcraftsman commented Dec 16, 2017

Hello @lxzxl,

In Markdown you either indent code blocks with four spaces or you use fenced code blocks (i.e. the three backticks). Using both doesn't work.

In the future, please refer to the Hugo Discussion Forum for questions.

@lxzxl
Copy link
Author

lxzxl commented Dec 16, 2017

@digitalcraftsman Thank you for your answer! I found 8 spaces can solve the problem.

@kaushalmodi
Copy link
Contributor

kaushalmodi commented Dec 19, 2017

@lxzxl @digitalcraftsman If I understand correctly, this is the same as this Blackfriday bug: russross/blackfriday#239.

The hack I use only in such cases is to replace the the Markdown list chars dash (HYPHEN-MINUS) character or a PLUS SIGN (0x2b) with the HYPHEN character (which looks like HYPHEN-MINUS, but has a different binary code.. 0x2010 instead of 0x2d). That is enough to fool Blackfriday to get around this bug.

@lxzxl
Copy link
Author

lxzxl commented Dec 20, 2017

@kaushalmodi Good idea, thank you! But the HYPHEN character breaks YAML file. So it doesn't work for my case.

@radu-munteanu
Copy link

radu-munteanu commented Apr 3, 2019

Gitlab, Github, even Okular in KDE shows the md files right. This is a BUG in Hugo. I don't know why this issue is closed.

  • the 8 spaces hack works, but it's not perfect, it indents all code by one tab (4 spaces);
  • changing the character with a similar one does fix the looks, but it will fail to create a valid YAML when you copy paste the code.

The same issue applies also to asterix sign, and I think the same happen to other special chars that are at the beginning of a line in a code block.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants