# 是否有办法用“监视词”（或其他方式）来“修复”--到en破折号的映射？

**URL:** <https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118>\
**Category:** Feature\
**Created:** [2021年十一月3日 14:57 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118 "2021-11-03T14:57:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [2021年十一月3日 14:57 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/1 "2021-11-03T14:57:22Z")

</div>

出于可能完全善意的原因，Discourse 会将 `--` 替换为 `–`（短破折号），将 `---` 替换为 `—`（长破折号）。

我觉得这是一个小烦恼，因为当人们在电子邮件中使用 `--` 写作时（或者在旧时代的打字机上），他们 _几乎总是_ 想使用长破折号。短破折号仅用于几种相当冷门的场合，例如数字或时间的范围（“派对从 7–9 点开始”）、比分或投票结果（“她以压倒性优势获胜，78–22！”），或者偶尔用于复合形容词（“第一次世界大战–时代”）。所有这些用例在打字机或普通键盘上都由 _单个_ `-` 字符表示，大多数人的写作也是如此。

所以基本上，Discourse 的做法 _几乎总是错的_（就“错”的极度吹毛求疵的定义而言）。

我觉得建议这是一个应该全局修复的 bug 可能是在 _徒劳无功_，所以我想知道如何本地配置我的网站，这样至少 _这一点_ 不会让我心烦。我考虑过使用单词替换功能，但这似乎也会破坏那些使用 `---------` 或类似符号作为 Markdown 水平线或标题的情况。

还有其他想法吗？

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2021年十一月3日 15:57 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/2 "2021-11-03T15:57:15Z")

</div>

您可以通过 `enable_markdown_typographer` 管理员设置将其关闭吗？这也会阻止 -\u003e 和 ™ 等转换，但这似乎是最简单的方法。

---

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [2021年十一月3日 16:13 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/3 "2021-11-03T16:13:03Z")

</div>

我喜欢其他的。这个完全是错的™。

---

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [2022年十月20日 10:29 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/4 "2022-10-20T10:29:45Z")

</div>

好的，这个还是让我很困扰。我意识到这不仅仅是“我的”网站有问题。

Markdown 的吸引力之一——甚至超过其他一些轻量级文本标记语言——在于普通的 ASCII 文本约定得以保留，而且你通常不必做任何奇怪的事情就能让纯文本段落按预期渲染。_这破坏了这一点。_ \[1\]

那么，我换个方式问。你们是否愿意修改 Discourse 中使用的 Markdown 排版功能，将 `--` 渲染成长破折号而不是短破折号？ \[2\]

感谢您的考虑。🙂

* * *

1. 同样，对于“破坏”这个词来说，这有点吹毛求疵，但你知道，_仍然是这样_ 

2. 也就是说，通常正确的“`—`”而不是太短的“`–`”？

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2022年十月20日 11:34 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/5 "2022-10-20T11:34:54Z")

</div>

> [@mattdm](#):
>
> 你们是否愿意修改 Discourse 中使用的 Markdown Typographer 功能，将 `--` 渲染成长破折号而不是短破折号？

嗯，我们不能简单地更改规则，因为_短破折号_和_长破折号_的首选用法似乎因您的语言和国家/地区而异。在德语中，当我们写 `--` 时，我们绝对想要_短破折号_，而且我认为法语和英式英语也可能如此，至少在我浏览了 [Dash - Wikipedia](https://en.wikipedia.org/wiki/Dash) 之后，我的印象是这样的。

站点设置是否足够？ Discourse 是否应根据用户的界面语言自动在_短破折号_和_长破折号_之间切换？我不确定最佳解决方案是什么…… 🤔

---

<div class="post-metadata">

**Author:** ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)\
**Post date:** [2022年十月20日 11:47 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/6 "2022-10-20T11:47:02Z")

</div>

我真的没有什么意见。我声称很少有人能看出区别或在意它。

> **一些无关紧要的…**
>
> ~~我所知道的我喜欢 → ™ 等，但创建表格很麻烦，因为 - - 会变成 —~~
> 
> 我编辑了那个帖子，因为我得到建议说单个 - 就足够了。我不知道 — 每天都有新东西。

---

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [2022年十月20日 15:02 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/7 "2022-10-20T15:02:24Z")

</div>

> [@gerhard](#):
>
> 嗯，我们不能简单地更改规则，因为_en dash_和_em dash_的首选用法似乎因您的语言和国家/地区而异。在德语中，当我们写 `--` 时，我们肯定想要_en dash_，而且我认为法语和英式英语也可能如此，至少在我浏览 [Dash - Wikipedia](https://en.wikipedia.org/wiki/Dash) 后留下的印象是这样。

真有趣！今天我学到了！

按语言区分可能很有趣——尽管我满足于一种更改它的方法。（[https://www.npmjs.com/package/markdown-it-replacements）](https://www.npmjs.com/package/markdown-it-replacements%EF%BC%89)

---

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [2024年四月12日 00:12 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/8 "2024-04-12T00:12:48Z")

</div>

> [@JammyDodger](#):
>
> 您可以使用 `enable_markdown_typographer` 管理员设置将其关闭？它也会停止 → 和 ™ 等，但这似乎是最简单的方法。

今天，我意识到该选项的帮助文本在 _嘲笑我_。它说：

> `使用排版规则提高文本的可读性：将直引号 ' 替换为弯引号 ’，(tm) 替换为符号，-- 替换为长破折号 – 等`

它 _说_ 是长破折号。

但亲爱的朋友们，那 _是短破折号_。

哦，这人性！

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2024年四月12日 02:05 UTC](https://meta.discourse.org/t/can-i-fix-the-mapping-of-to-en-dash-with-watched-words-or-in-some-other-way/208118/9 "2024-04-12T02:05:05Z")

</div>

这里真的没有办法让所有人都满意。

出于好奇，我想知道……

```plaintext
[root@fedora-39 /]# grep DASH /usr/share/X11/locale/en_US.UTF-8/Compose 
<Multi_key> <minus> <minus> <period> : "–" U2013 # EN DASH
<Multi_key> <minus> <minus> <minus> : "—" U2014 # EM DASH

```

看起来 Fedora 本身也同意两个连字符 → `–`（en dash）和三个连字符 → `—`（em dash）：😁
