BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Italic and bold markdown notations not recognized correctly

Go down

Italic and bold markdown notations not recognized correctly Empty Italic and bold markdown notations not recognized correctly

Post by zbx1425 on Sat Mar 07, 2020 1:22 pm

I just finished the translation at https://openbve-project.net/documentation_hugo/zh_cn/routes/csv.html, and it turned out not working very well.
There are quite a few stars (*) floating around in the document, 462 of them to be exact. And they are from italic and bold notations which are not correctly parsed. I tried to parse the markdown files using multiple online parsers and typora, and no such problem is encountered. How can I get the symbols fixed?
zbx1425
zbx1425

Posts : 125
Join date : 2017-08-18
Location : China

https://zbx1425.tk

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by S520 on Sat Mar 07, 2020 2:06 pm

Thank you for your translation work.
First of all, please check the notation of markdown.
https://www.markdownguide.org/basic-syntax/

When modifying characters such as italics, a space is required before and after (*).
Code:
AAAA *BBB* CCC

Since the translation is already completed, you need to lower the translation completion rate once from 100% or make an empty commit on GitHub.
Otherwise, the changes will not be reflected on the web page.
S520
S520

Posts : 93
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by zbx1425 on Sun Mar 08, 2020 1:37 am

S520 wrote:When modifying characters such as italics, a space is required before and after (*).
Code:
AAAA *BBB* CCC
I have also read this manual given by you. It says right there:
https://www.markdownguide.org/basic-syntax/#italic wrote:To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.
MarkdownHTMLRendered Output
Code:
A*cat*meow
Code:
A<em>cat</em>meow
Acatmeow
So as it suggests, italic without space before and after is actually supported, at least in some implementions. It seems my way of using italic is not unstandard.
I tested the code of paragraphs that are incorrectly shown in babelmark, and the result is that 34 out of 36 markdown parser implementions succeed in recognizing italic notation without space before and after, and succeed in parsing my entire markdown file without serious formatting issues. Please see this.
Anyway I will try to use some regex clause to fix the errors in my files. But it seems that it is caused by "unstandard" behavior of the parser used by hugo site generator. I would prefer, maybe changing the parser used now to be one compatible with such notations, since I am not good at regex Wink
zbx1425
zbx1425

Posts : 125
Join date : 2017-08-18
Location : China

https://zbx1425.tk

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by S520 on Sun Mar 08, 2020 3:10 am

Hmm...

We are using Hugo v0.53.

This version uses blackfriday internally.
https://gohugo.io/getting-started/configuration-markup/#blackfriday

blackfriday doesn't seem to parse correctly like the site you indicated because it doesn't conform to CommonMark.

However, Hugo uses Goldmark instead of blackfriday since v0.60.
https://gohugo.io/getting-started/configuration-markup/#goldmark

I think Goldmark is likely to parse correctly because it conforms to CommonMark.

Therefore, I will work on upgrading Hugo.
S520
S520

Posts : 93
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by zbx1425 on Sun Mar 08, 2020 3:13 am

S520 wrote:This version uses blackfriday internally.
https://gohugo.io/getting-started/configuration-markup/#blackfriday
Ah, I see the problem. It is one of the only two which do not support this syntax Very Happy
Thank you!
zbx1425
zbx1425

Posts : 125
Join date : 2017-08-18
Location : China

https://zbx1425.tk

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by zbx1425 on Sun Mar 08, 2020 3:52 am

S520 wrote:Therefore, I will work on upgrading Hugo.
By the way, some personal idea about the new hugo documentation:
1. The language list is currently aligned to the left of the button, and it overflows the page. This can be solved by changing the line 930 of /documentation_hugo/css/bulma.custom.css to 
Code:
   right: 0;
2. The page titles at the left of the page have a low contrast compared to the background. I prefer changing its color as it can improve readability. I think changing line 74 of /documentation_hugo/css/theme.css to
Code:
 color: #004488;
produces a better appearance.
3. There are many warnings about This command can only be used at the beginning of a block.
They are pure red in the hugo documentation, and I personally think there are too much of them and messed up the colours of the page, while flooding other more important notes. Would you by any change degrade them to notices, or use a less saturated color?
4. The document currently does not fit mobile devices well so far. I hope it can be better...
zbx1425
zbx1425

Posts : 125
Join date : 2017-08-18
Location : China

https://zbx1425.tk

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by S520 on Sun Mar 08, 2020 10:02 am

I have prepared a preview site that has been upgraded to 0.66.0.
https://5e64b9e61a1681409f0977c6--openbve-japan.netlify.com/en/

It seems that there are some points where the display has improved and some points where it has deteriorated.

Let's compare the sentence of the following page as an example.
https://5e64b9e61a1681409f0977c6--openbve-japan.netlify.com/zh_cn/routes/csv.html

0.53: Blackfriday
Code:
这个文件一般来说可以被放在*Train*或*Railway*文件夹下的任何地方。文件名可以随意,但扩展名必须是.csv。

0.66.0: Goldmark (CommonMark compliant)
Code:
这个文件一般来说可以被放在Train或Railway文件夹下的任何地方。文件名可以随意,但扩展名必须是**.csv**。

(As reference) CommonMark: https://spec.commonmark.org/dingus/
Code:
这个文件一般来说可以被放在Train或Railway文件夹下的任何地方。文件名可以随意,但扩展名必须是**.csv**。


To be honest, I can't say which is better...


Next, let's talk about page design.

First, please know how this document was born.

The original document described HTML directly.

Because it is difficult to update or multilingualize as it is, we switched to Hugo using markdown.

To make the modified document more acceptable, the appearance has not changed much from the original.

As a result, current documents are difficult to read on smartphones.

Unfortunately I'm not familiar with page design, so I'm very happy if you make suggestions on GitHub's pull requests etc.
S520
S520

Posts : 93
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by zbx1425 on Sun Mar 08, 2020 10:58 am

S520 wrote:To make the modified document more acceptable, the appearance has not changed much from the original.
I actually know this since I have already done a translation upon the [original html document (I have no idea why this link on the left doesn't get highlighted)] years ago, and I copied the texts over this time. But you can certainly see a difference in the link color between them...
Italic and bold markdown notations not recognized correctly New10Italic and bold markdown notations not recognized correctly Origin10 You can see the color of the new document is not as dark, and its appearance is not as clear.
I actually would be happy to agree migrating to a commonmark compatible parser, since it decrases the number of problems to 70, which seems easier to fix manually. Thank you so much!
zbx1425
zbx1425

Posts : 125
Join date : 2017-08-18
Location : China

https://zbx1425.tk

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by S520 on Sun Mar 08, 2020 11:19 am

I have submitted a pull request.
https://github.com/leezer3/OpenBVE-Documentation-Hugo/pull/15

The outline has been described, but please supplement any missing parts.
S520
S520

Posts : 93
Join date : 2018-08-24
Location : Japan

https://github.com/s520

Back to top Go down

Italic and bold markdown notations not recognized correctly Empty Re: Italic and bold markdown notations not recognized correctly

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum