# 未设置默认语言时，代码块不会将其信息字符串传递给生成的标记

**URL:** https://meta.discourse.org/t/with-no-default-language-set-code-fences-dont-pass-their-info-string-to-the-generated-markup/193094
**Category:** Support
**Created:** [2021年六月8日 07:37 UTC](https://meta.discourse.org/t/with-no-default-language-set-code-fences-dont-pass-their-info-string-to-the-generated-markup/193094 "2021-06-08T07:37:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jcayzac](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jcayzac/32/73266_2.png) [@jcayzac](https://meta.discourse.org/u/jcayzac)
#### Post date: [2021年六月8日 07:37 UTC](https://meta.discourse.org/t/with-no-default-language-set-code-fences-dont-pass-their-info-string-to-the-generated-markup/193094/1 "2021-06-08T07:37:34Z")

</div>

我无法找到一种简单的方法，将代码 fences 的信息字符串（info string）传递到生成的标记中，尤其是当它指定了一种不在语法高亮列表中的语言时：

- 如果我将默认代码 fence 语言设置为 `nohighlight`，它会忽略信息字符串，并生成 `class="lang-nohighlight"`。
- 如果我将默认代码 fence 语言设置为 `auto`，它也会忽略信息字符串，并尝试猜测内容，例如为 ````plantuml` 生成 `class="lang-swift"`。
- 如果我将默认代码 fence 语言取消设置（设为空），至少我的语言不会被替换成其他内容，但它也完全不会出现在生成的标记中。

来自 remark / prismjs 生态系统的用户可能会期望：即使语言未被 highlightjs 处理或样式化，代码 fence 信息字符串中指定的语言仍应保留在标记中，例如像 `<pre><code data-lang="plantuml">…</code></pre>` 这样。
