# The syntax highlighter doesn't support \`--word-diff\`s

**URL:** https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410
**Category:** Support
**Created:** [2 november 2025 om 21:03 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410 "2025-11-02T21:03:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [2 november 2025 om 21:03 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410/1 "2025-11-02T21:03:55Z")

</div>

As an example, `git diff --word-diff old.sh new.sh` produces:

> ```diff
> diff --git a/old.sh b/new.sh
> index 18237f5..208b37d 100644
> --- a/old.sh
> +++ b/new.sh
> @@ -1,8 +1,22 @@
> {+GRUB_TIMEOUT="15"+}
> {+ # Original:+} GRUB_TIMEOUT=5
> GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
> {+# Original: Identical+}
> GRUB_DEFAULT="saved"
> {+# Original: Identical+}
> GRUB_DISABLE_SUBMENU="true"
> {+# Original: GRUB_DISABLE_SUBMENU=true+}
> {+GRUB_TERMINAL_OUTPUT="gfxterm"+}
> {+ # Original:+} GRUB_TERMINAL_OUTPUT="console"
> GRUB_CMDLINE_LINUX="rd.luks.uuid=luks-31b94f4a-915c-47ee-af7a-a7c948b23cf4 {+quiet"+}
> {+ # Original: GRUB_CMDLINE_LINUX="rd.luks.uuid=luks-31b94f4a-915c-47ee-af7a-a7c948b23cf4+} rhgb quiet"
> {+GRUB_DISABLE_RECOVERY="false"+}
> {+ # Original:+} GRUB_DISABLE_RECOVERY="true"
> {+GRUB_ENABLE_BLSCFG="true"+}
> {+ # Original:+} GRUB_ENABLE_BLSCFG=true
> {+# Reason: https://discussion.fedoraproject.org/t/missing-boot-entries-with-grub-enable-blscfg-true/70805/3+}
> {+GRUB_GFXMODE="2560x1600,auto"+}
> {+ # Original: None+}
> {+GRUB_DISABLE_OS_PROBER="true"+}
> {+ # Original: None+}
> {+ # Reason: https://github.com/MaddieM4/os-prober/issues/5#issue-777438588+}
> 
> ```

* * *

> ****
>
> A real-world usage is:
> 
> > **[How can I force the LUKS prompt to appear before I type in the preboot TTY?](https://discussion.fedoraproject.org/t/how-can-i-force-the-luks-prompt-to-appear-before-i-type-in-the-preboot-tty/171555/6)**
> >
> > @yuntaz, yes, and slightly for the better. However, it now appears truncated, with the cursor misplaced, which I doubt is intended: Additionally, the full prompt solely appears on type, as before: @Augenauf, I’ve no custom style for...

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 november 2025 om 23:12 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410/2 "2025-11-02T23:12:43Z")

</div>

I think it is best reporting this to hljs on GitHub, given it is an issue with the default diff implementation:

> **[Demo - highlight.js](https://highlightjs.org/demo)**
>
> Preview how highlight.js will highlight your code snippets and share them with other syntax highlighting nerds

> **[Issues · highlightjs/highlight.js](https://github.com/highlightjs/highlight.js/issues)**
>
> JavaScript syntax highlighter with language auto-detection and zero dependencies. - Issues · highlightjs/highlight.js

Discourse really can not control this easily, we simply pull the changes from upstream.

---

<div class="post-metadata">

### Author: ![roke\_julian\_lockhart](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roke_julian_lockhart/32/540179_2.png) [@roke\_julian\_lockhart](https://meta.discourse.org/u/roke_julian_lockhart)
#### Post date: [2 november 2025 om 23:28 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410/3 "2025-11-02T23:28:00Z")

</div>

@sam, thanks. In retrospect, this shan’t be possible:

[https://github.com/highlightjs/highlight.js/issues/2911#issuecomment-739586916](https://github.com/highlightjs/highlight.js/issues/2911#issuecomment-739586916)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 november 2025 om 23:39 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410/4 "2025-11-02T23:39:42Z")

</div>

Technically a theme component can ship a different grammer, it is complicated but doable imo.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2 december 2025 om 23:39 UTC](https://meta.discourse.org/t/the-syntax-highlighter-doesnt-support-word-diff-s/387410/5 "2025-12-02T23:39:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
