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

Syntax highlighting for "diff" doesn't work #2735

Open
PetrLaskevic opened this issue Dec 15, 2024 · 3 comments
Open

Syntax highlighting for "diff" doesn't work #2735

PetrLaskevic opened this issue Dec 15, 2024 · 3 comments

Comments

@PetrLaskevic
Copy link

Bug Report

```diff code blocks are not syntax highlighted despite documentation saying their highlighting is supported.

Step to reproduce

  1. Diff is in the list of supported languages for Syntax highlighting
  2. Then it should work (with some default theme)
  3. To confirm syntax highlighting is enabled on the Zola project, there is a second block with Python, which is correctly colorful.

I'm sorry if the docs refer to some other diff than the linux diff command.
In that case, please clarify what it actually refers to.

Excerpt from markdown file:

```diff
petr@petr-IdeaPad:~/Documents/zola miniweb$ diff a.txt b.txt --side-by-side --color -W 185
petr@petr-IdeaPad:~/Documents/tda/TdA25-Polysyndeton/TdA25-Polysyndeton$ git log       petr@petr-IdeaPad:~/Documents/tda/TdA25-Polysyndeton/TdA25-Polysyndeton$ git log
* 578527336d49e8e134c3c47d6ccfc081734a3951 (HEAD -> testApiFromSvelte) Change python to p   |   * 3d87e707a3ede575c6aad133219b39c7e110255e (HEAD -> testApiFromSvelte) Change python to p
* 00cf18a1460ed229e6dd8ec69ac7c43656061212 Added .gitignore to ignore files in /static =    |   * fc2717292414e3a8423fb7092adfa230e058995f Added .gitignore to ignore files in /static = 
* 6ee7057ad540aab353b642102e20a07f2f109d92 Zkousim ze Svelte jestli funguje Flask API       |   * 556355dbbac7e90f0c9da2d69c054ec3c3a62102 Zkousim ze Svelte jestli funguje Flask API
* bc15e960a6b842d4dabfc37bf9a9aeae850cb76b Add even more content                            <
* 2ae88f90c73f06c43c9553c8b7f892924a67679a Add content to make sure Docker loads this fil   <
* 322b9d12732151bf8f3fac4bb830153ddc6c8024 Zkousim, jestli flask api funguje                <
* 1eff5b7cdcaf7ab4f94400225d786fb4114eda13 svelte build output to backend dir                   * 1eff5b7cdcaf7ab4f94400225d786fb4114eda13 svelte build output to backend dir
* b8e2c1d1cb5e5a996852ad025887df2581ffeb74 local build script                                   * b8e2c1d1cb5e5a996852ad025887df2581ffeb74 local build script
*   21750c8a1841bfb3dc2d088d9adfbe66231076db Merge pull request #1 from polysyndeton-tda/       *   21750c8a1841bfb3dc2d088d9adfbe66231076db Merge pull request #1 from polysyndeton-tda/
|\                                                                                              |\  
| * 997d68a7a762cb49dad527fb0607d894f16311c9 (origin/backendFix, backendFix) Fix test for       | * 997d68a7a762cb49dad527fb0607d894f16311c9 (origin/backendFix, backendFix) Fix test for
|/                                                                                              |/  
* 55041d622b957086d4fdb74da141a5b31077def8 Add the /api route which returns {"organizatio       * 55041d622b957086d4fdb74da141a5b31077def8 Add the /api route which returns {"organizatio
* 53ef49181b8c4e41c7b58511d507aab08a036e01 change actionfile name                               * 53ef49181b8c4e41c7b58511d507aab08a036e01 change actionfile name
* 3bd4e261cf734f885a521c20fcc271f817b6e3cb Create main.yml                                      * 3bd4e261cf734f885a521c20fcc271f817b6e3cb Create main.yml
* e2377f15db7c64a81aaa2d0c3115c3f86fdb313d github action init                                   * e2377f15db7c64a81aaa2d0c3115c3f86fdb313d github action init
                                                                                            >   * 378ac40e98be74d0f8baa79298e2d43927221d0a Update README.md
                                                                                            >   * 02eb546c4adb873507250f55f7de61cf758a952f Initial commit
```

```python
print("hello")
```

If I omit the diff command, and only show output, like so:

```diff
petr@petr-IdeaPad:~/Documents/tda/TdA25-Polysyndeton/TdA25-Polysyndeton$ git log       petr@petr-IdeaPad:~/Documents/tda/TdA25-Polysyndeton/TdA25-Polysyndeton$ git log
* 578527336d49e8e134c3c47d6ccfc081734a3951 (HEAD -> testApiFromSvelte) Change python to p   |   * 3d87e707a3ede575c6aad133219b39c7e110255e (HEAD -> testApiFromSvelte) Change python to p
* 00cf18a1460ed229e6dd8ec69ac7c43656061212 Added .gitignore to ignore files in /static =    |   * fc2717292414e3a8423fb7092adfa230e058995f Added .gitignore to ignore files in /static = 
* 6ee7057ad540aab353b642102e20a07f2f109d92 Zkousim ze Svelte jestli funguje Flask API       |   * 556355dbbac7e90f0c9da2d69c054ec3c3a62102 Zkousim ze Svelte jestli funguje Flask API
* bc15e960a6b842d4dabfc37bf9a9aeae850cb76b Add even more content                            <
* 2ae88f90c73f06c43c9553c8b7f892924a67679a Add content to make sure Docker loads this fil   <
* 322b9d12732151bf8f3fac4bb830153ddc6c8024 Zkousim, jestli flask api funguje                <
* 1eff5b7cdcaf7ab4f94400225d786fb4114eda13 svelte build output to backend dir                   * 1eff5b7cdcaf7ab4f94400225d786fb4114eda13 svelte build output to backend dir
* b8e2c1d1cb5e5a996852ad025887df2581ffeb74 local build script                                   * b8e2c1d1cb5e5a996852ad025887df2581ffeb74 local build script
*   21750c8a1841bfb3dc2d088d9adfbe66231076db Merge pull request #1 from polysyndeton-tda/       *   21750c8a1841bfb3dc2d088d9adfbe66231076db Merge pull request #1 from polysyndeton-tda/
|\                                                                                              |\  
| * 997d68a7a762cb49dad527fb0607d894f16311c9 (origin/backendFix, backendFix) Fix test for       | * 997d68a7a762cb49dad527fb0607d894f16311c9 (origin/backendFix, backendFix) Fix test for
|/                                                                                              |/  
* 55041d622b957086d4fdb74da141a5b31077def8 Add the /api route which returns {"organizatio       * 55041d622b957086d4fdb74da141a5b31077def8 Add the /api route which returns {"organizatio
* 53ef49181b8c4e41c7b58511d507aab08a036e01 change actionfile name                               * 53ef49181b8c4e41c7b58511d507aab08a036e01 change actionfile name
* 3bd4e261cf734f885a521c20fcc271f817b6e3cb Create main.yml                                      * 3bd4e261cf734f885a521c20fcc271f817b6e3cb Create main.yml
* e2377f15db7c64a81aaa2d0c3115c3f86fdb313d github action init                                   * e2377f15db7c64a81aaa2d0c3115c3f86fdb313d github action init
                                                                                            >   * 378ac40e98be74d0f8baa79298e2d43927221d0a Update README.md
                                                                                            >   * 02eb546c4adb873507250f55f7de61cf758a952f Initial commit
```

It is still not colorful.

Environment

Zola version: zola 0.19.2

Expected Behavior

The diff block is colorful (what I see in bash):
image

Current Behavior

Syntax highlighting for diff block doesn't work, it stays black and white.

@Keats
Copy link
Collaborator

Keats commented Dec 16, 2024

My guess is that the syntax highlighting for diff doesn't support side by side diffs?

@PetrLaskevic
Copy link
Author

My guess is that the syntax highlighting for diff doesn't support side by side diffs?

It seems so, yes. I tried diff a.txt b.txt --color and that worked.
Is there any way to add support for side by side diffs ?
If yes, could you please point me in the right direction? (I'm willing to try to add them)

@Keats
Copy link
Collaborator

Keats commented Dec 17, 2024

You would have to update the syntax highlighting Sublime uses to support it but even then we're stuck with old versions of their syntax due to the library we're using for syntax highlighting so I'm not sure it would work.

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

No branches or pull requests

2 participants