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

fixed all _xx_ into *xx* #727

Merged
merged 2 commits into from
May 3, 2018
Merged

fixed all _xx_ into *xx* #727

merged 2 commits into from
May 3, 2018

Conversation

Jinjiang
Copy link
Member

经过测试,发现两个下划线之间的字符少于等于两个时,不会被转换为<em>,因此把文章里所有字符数少于等于 2 的下划线对换成了星号对,即可修复问题。
components.md 文件没有改动,因为新版已经在 review 中了
谢谢
Ref: #725

@Jinjiang Jinjiang requested a review from Justineo April 29, 2018 13:21
Copy link
Member

@Justineo Justineo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不要统一全用 *?省得啥时候有改动的时候还要记得这个坑……

@Jinjiang
Copy link
Member Author

我先试一下 VuePress 吧,如果 VuePress 没有这个问题就不整理了

@Justineo
Copy link
Member

VuePress 用的是 markdown-it,我试了一下也是这样的。

@Jinjiang
Copy link
Member Author

我本地试了一下 VuePress 似乎没有这个问题,x 中午 都是正常显示斜体字

@Justineo
Copy link
Member

不止看内容的,应该要看前后没有空格的。

@Jinjiang
Copy link
Member Author

我复现了
仓库:https://github.com/Jinjiang/vue-press-test
预览:https://dazzling-ride-09e3d2.netlify.com
似乎 GitHub Flavored Markdown 也是如此

@Jinjiang
Copy link
Member Author

Jinjiang commented Apr 30, 2018

感觉这不像是巧合。。莫非 markdown 规范有什么我们没注意到的细节吗?
另外全部替换下划线的工作量感觉有点大,而且星号似乎更影响源代码阅读那么一点点,个人感觉

@Justineo
Copy link
Member

我看了一下,是 GFM 规定的……对于中文来说,只能用 * 才能确保渲染为 <em> 了,因为没有空格。

@Justineo
Copy link
Member

5*6*78<p>5<em>6</em>78</p>

https://github.github.com/gfm/#example-346

5_6_78<p>5_6_78</p>

https://github.github.com/gfm/#example-351

@Jinjiang
Copy link
Member Author

Jinjiang commented May 1, 2018

我今天仔细考虑了一下,首先为什么下划线不生效及其原因已经通过 GFM 的描述得知了,不是 bug;第二,这个理由不足以促使英文原版从下划线改为星号——确切的说甚至这个理由支撑了英文版使用下划线;第三,在这种情况下中文翻译把下划线全部自动转换为星号是一个不必要的成本;第四,我们可以 case by case 的处理下划线不生效的情况,相信这种情况只会是其中的一部分。

总结一下我的建议:

  1. 下划线 by default,默认不产生中英文之间格式不一致的认知成本
  2. 针对下划线不生效的情况进行特殊处理

如果我们觉得 OK 的话,今后可以按照这个约定来处理:)
谢谢

@Justineo
Copy link
Member

Justineo commented May 1, 2018

针对下划线不生效的情况进行特殊处理

可是我理解按 GFM 的规则,中文内容大多数内容应该都会不生效?

@Jinjiang
Copy link
Member Author

Jinjiang commented May 2, 2018

好吧,那不纠结了,中文版斜体粗体全部换用星号吧

@Justineo Justineo merged commit 044a5c9 into master May 3, 2018
@Justineo Justineo deleted the em branch May 3, 2018 15:20
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

Successfully merging this pull request may close these issues.

2 participants