# 部分围栏代码块的自动高亮失效

**URL:** <https://meta.discourse.org/t/automatic-highlighting-fails-for-some-fenced-code-blocks/408503>\
**Category:** Bug\
**Tags:** fixed, bug\
**Created:** [2026年七月25日 08:16 UTC](https://meta.discourse.org/t/automatic-highlighting-fails-for-some-fenced-code-blocks/408503 "2026-07-25T08:16:46Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)\
**Post date:** [2026年七月28日 17:49 UTC](https://meta.discourse.org/t/automatic-highlighting-fails-for-some-fenced-code-blocks/408503/8 "2026-07-28T17:49:27Z")

</div>

代码未高亮，因为存在一个条件，会跳过任何超过 1k 字符的代码的自动检测。

[此 PR](https://github.com/discourse/discourse/pull/42106) 修改了逻辑，使用有界的 2k 前缀来检测语言。

---

_[View the full topic](https://meta.discourse.org/t/automatic-highlighting-fails-for-some-fenced-code-blocks/408503)._
