Skip to content

Commit

Permalink
Update highlight.js / hidden line rust. (#1566)
Browse files Browse the repository at this point in the history
fix #1565 

## Why?
mdBook during the parsing, put's all the hidden lines (beggining with
`#`) inside the `span` tag with `className="boring"`.
mdBook generated css files sets all the files with `boring` className to
be `display: none`. Unfortunately, new version of `highlight.js` wipes
all those mdBook spans during the highlighting process.

This version of `highlight.js` is based directly upon the mdBook
`highlight.js`, so hidden lines work as intended inside rust codes
examples.
  • Loading branch information
wawel37 authored Sep 3, 2024
1 parent 4c3e294 commit 473afac
Show file tree
Hide file tree
Showing 9 changed files with 5,081 additions and 9,941 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::AdditionalMetadata;

pub fn generate_book_toml_content(package_metadata: &AdditionalMetadata) -> String {
formatdoc! {
r#"
r##"
[book]
authors = {:?}
language = "en"
Expand All @@ -21,7 +21,10 @@ pub fn generate_book_toml_content(package_metadata: &AdditionalMetadata) -> Stri
[output.html.fold]
enable = true
level = 0
"#,
[output.html.code.hidelines]
cairo = "#"
"##,
package_metadata.authors.clone().unwrap_or_else(|| vec!["<unknown>".to_string()]),
package_metadata.name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ runnable = false
[output.html.fold]
enable = true
level = 0

[output.html.code.hidelines]
cairo = "#"
9 changes: 1 addition & 8 deletions extensions/scarb-doc/theme/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Contributing

If you want to modify the way that the highlighting of Cairo code sample works, you need to:

1. Clone the repository at https://github.com/highlightjs/highlight.js
2. Copy our [cairo.js](./cairo.js) into `highlight.js/src/languages` directory
3. Run `npm install`
4. Modify the copied `cairo.js`
5. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx nim nix properties r scala x86asm yaml cairo`
6. Replace our [highlight.js](./highlight.js) content with newly built `highlight.js/build/highlight.min.js`
If you want to modify the way that the highlighting of Cairo code sample works, you just need to change the `cairo` language definition inside the `highlight.js`.
Loading

0 comments on commit 473afac

Please sign in to comment.