Skip to content

Commit 473afac

Browse files
authored
Update highlight.js / hidden line rust. (#1566)
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.
1 parent 4c3e294 commit 473afac

File tree

9 files changed

+5081
-9941
lines changed

9 files changed

+5081
-9941
lines changed

extensions/scarb-doc/src/docs_generation/markdown/book_toml.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::AdditionalMetadata;
44

55
pub fn generate_book_toml_content(package_metadata: &AdditionalMetadata) -> String {
66
formatdoc! {
7-
r#"
7+
r##"
88
[book]
99
authors = {:?}
1010
language = "en"
@@ -21,7 +21,10 @@ pub fn generate_book_toml_content(package_metadata: &AdditionalMetadata) -> Stri
2121
[output.html.fold]
2222
enable = true
2323
level = 0
24-
"#,
24+
25+
[output.html.code.hidelines]
26+
cairo = "#"
27+
"##,
2528
package_metadata.authors.clone().unwrap_or_else(|| vec!["<unknown>".to_string()]),
2629
package_metadata.name
2730
}

extensions/scarb-doc/tests/data/hello_world_no_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"

extensions/scarb-doc/tests/data/hello_world_sub_package_no_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"

extensions/scarb-doc/tests/data/hello_world_sub_package_with_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"

extensions/scarb-doc/tests/data/hello_world_sub_package_without_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"

extensions/scarb-doc/tests/data/hello_world_with_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"

extensions/scarb-doc/tests/data/hello_world_without_features/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ runnable = false
1414
[output.html.fold]
1515
enable = true
1616
level = 0
17+
18+
[output.html.code.hidelines]
19+
cairo = "#"
+1-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
# Contributing
22

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

0 commit comments

Comments
 (0)