如何在将 markdown 从 github 转换为阅读文档时保留换行符?

问题描述 投票:0回答:2

我正在尝试将一些文档从 github 转换为阅读文档。 我遇到了一个有趣的问题,我的换行符(又名换行符又名 /n)在转换中丢失了。这发生在工具提示和摘要/细节

如何在阅读文档中获取多行摘要和工具提示?

例如: 我在 github 中的代码:

[tooltip_example_1]: ## "this is line 1 of my tooltip
this is line 2 of my tooltip"

this ia an example of [multiline tooltip][tooltip_example_1]


<details><summary> this is an example of a summary with multiple lines details </summary>
this is line 1 of my details.
    
this is line 2 of my details.
</details>

这就是它在 github 中的样子,带有漂亮的换行符。

但是在阅读文档中构建页面之后,它看起来是这样的:

tooltip 标签坏了,我所有的总结细节都在一行上

我尝试使用 /n、 等...
我尝试了单个和多个空行... 我试图用谷歌搜索一些解决方案,但到目前为止还没有明确的解释或解决方案。 理想情况下,我很想找到一个简单的编辑器,我可以用来直接修改我的阅读文档,因为我对 github 并不特别感兴趣。

github markdown newline read-the-docs
2个回答
0
投票
partial answer from @DecimalTum:

so <br> half works!   thanks you. <br/>

It does work for the sumarry/details  but unfortunately it doesn't work for the tooltip .


to be more precise: 

1) for the summart this works:
<details><summary> this is an example of a summary with multiple lines details </summary>
this is line 1 of my details.<br> 
this is line 2 of my details.<br>
</details>

2) for the tooltip this doesnt:

[tooltip_example_1]: ## "this is line 1 of my tooltip <br>this is line 2 of my tooltip"

0
投票

我不太熟悉阅读文档和 mkdocs,但我的猜测是工具提示和

<details>
标签在 GitHub 和 mkdocs 中没有以相同的方式转换为 HTML。

细节标签

对于

<details>
标签,您可能需要直接使用HTML 以获得更多控制。这意味着使用
<br>
强制换行,或者您可以将行换行在 2 个不同的
<p>
标签或什至
<ul>
列表中。

多行工具提示

对于tooltip,可能是

mkdocs
不支持多行tooltips。如果是这样的话,最好在官方 GitHub 回购中提出一个问题。

与此同时,您可以随时尝试:

[tooltip_example_2]: ## "this is line 1 of my tooltip&#10;this is line 2 of my tooltip"

this is an example of [multiline tooltip][tooltip_example_2]

注意这里使用 十进制数字字符引用 换行字符。这个在 GitHub 上有效,但我无法确认它是否适用于 mkdocs。

© www.soinside.com 2019 - 2024. All rights reserved.