rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.4k stars 1.65k forks source link

Hidelines does not work with multiple languages #2354

Closed Mouthless-Stoat closed 7 months ago

Mouthless-Stoat commented 7 months ago

Problem

output.html.code.hidelines does not seem to work with any other language apart from the example language python and rust. I have try json, gdscript and none of the language work

Steps

  1. Create a new book
  2. In the book.toml add:
    [output.html.code.hidelines]
    json= "~"
  3. Edit a chapter and add
    ```json
    {
    ~"hello"
    }
    ```
  4. Render the page using mdbook serve and see the code block not render with hidden lines.

Possible Solution(s)

No response

Notes

No response

Version

mdbook v0.4.37
ehuss commented 7 months ago

Hm, I'm not able to reproduce with the given example. Can you check if there are any errors in the javascript console? Can you check if the generated HTML code block has <span class="boring">?

Mouthless-Stoat commented 7 months ago

After messing around some more seem to be my version of highlight.js being weird. It seem downloading a custom build of highlight.js cause some issue idk if this is more highlight.js issue or more of mdbook issue: image

All I did was go to the custom build site and select only json download that and copy over the highlight.min.js file into the theme/highlight.js file. While I'm here how do i acctually add a new 3rd party language to highlight.js

ehuss commented 7 months ago

The newer versions of highlight.js won't work. There are instructions at https://github.com/rust-lang/mdBook/blob/master/CONTRIBUTING.md#updating-highlightjs for checking out an older version and building it. We're currently on 10.1.1.