diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69eb2d49..9597a865 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -213,7 +213,7 @@ The following are instructions for updating [highlight.js](https://highlightjs.o 1. Compare the language list that it spits out to the one in [`syntax-highlighting.md`](https://github.com/camelid/mdBook/blob/master/guide/src/format/theme/syntax-highlighting.md). If any are missing, add them to the list and rebuild (and update these docs). If any are added to the common set, add them to `syntax-highlighting.md`. 1. Copy `build/highlight.min.js` to mdbook's directory [`highlight.js`](https://github.com/rust-lang/mdBook/blob/master/src/theme/highlight.js). 1. Be sure to check the highlight.js [CHANGES](https://github.com/highlightjs/highlight.js/blob/main/CHANGES.md) for any breaking changes. Breaking changes that would affect users will need to wait until the next major release. -1. Build mdbook with the new file and build some books with the new version and compare the output with a variety of languages to see if anything changes. The [test_book](https://github.com/rust-lang/mdBook/tree/master/test_book) contains a chapter with many languages to examine. +1. Build mdbook with the new file and build some books with the new version and compare the output with a variety of languages to see if anything changes. The [syntax GUI test](https://github.com/rust-lang/mdBook/tree/master/tests/gui/books/highlighting) contains a chapter with many languages to examine. Update the test (`highlighting.goml`) to add any new languages. ## Publishing new releases diff --git a/tests/gui/books/highlighting/README.md b/tests/gui/books/highlighting/README.md new file mode 100644 index 00000000..7a048d42 --- /dev/null +++ b/tests/gui/books/highlighting/README.md @@ -0,0 +1,3 @@ +# Syntax Highlighting + +This GUI test book is used for testing syntax highlighting. diff --git a/tests/gui/books/highlighting/book.toml b/tests/gui/books/highlighting/book.toml new file mode 100644 index 00000000..8ac1e916 --- /dev/null +++ b/tests/gui/books/highlighting/book.toml @@ -0,0 +1,2 @@ +[book] +title = "Syntax Highlighting" diff --git a/tests/gui/books/highlighting/src/SUMMARY.md b/tests/gui/books/highlighting/src/SUMMARY.md new file mode 100644 index 00000000..c634e325 --- /dev/null +++ b/tests/gui/books/highlighting/src/SUMMARY.md @@ -0,0 +1,3 @@ +# Summary + +- [Languages](./languages.md) diff --git a/tests/gui/books/test_book/src/languages/highlight.md b/tests/gui/books/highlighting/src/languages.md similarity index 100% rename from tests/gui/books/test_book/src/languages/highlight.md rename to tests/gui/books/highlighting/src/languages.md diff --git a/tests/gui/books/test_book/src/README.md b/tests/gui/books/test_book/src/README.md index 04d5afdc..2597d156 100644 --- a/tests/gui/books/test_book/src/README.md +++ b/tests/gui/books/test_book/src/README.md @@ -6,7 +6,6 @@ This contains dummy examples of various markdown elements and code languages, so This rough outline is : - individual : contains basic markdown elements such as headings, paragraphs, links etc. -- languages : contains a `hello world` in each of supported language to see changes in syntax highlighting - rust : contains language examples specific to rust, such as play pen, runnable examples etc. This is more for checking and fixing style, rather than verifying that correct code is generated for given markdown, that is better handled in tests. diff --git a/tests/gui/books/test_book/src/SUMMARY.md b/tests/gui/books/test_book/src/SUMMARY.md index d81f6ecb..bad60042 100644 --- a/tests/gui/books/test_book/src/SUMMARY.md +++ b/tests/gui/books/test_book/src/SUMMARY.md @@ -24,8 +24,6 @@ - [Strikethrough](individual/strikethrough.md) - [MathJax](individual/mathjax.md) - [Mixed](individual/mixed.md) -- [Languages](languages/README.md) - - [Syntax Highlight](languages/highlight.md) - [Rust Specific](rust/README.md) - [Rust Codeblocks](rust/rust_codeblock.md) - [Last numbered chapter](last.md) diff --git a/tests/gui/books/test_book/src/languages/README.md b/tests/gui/books/test_book/src/languages/README.md deleted file mode 100644 index 32c293f5..00000000 --- a/tests/gui/books/test_book/src/languages/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Syntax Highlighting - -This Currently contains following languages - -- apache -- armasm -- bash -- c -- coffeescript -- cpp -- csharp -- css -- d -- diff -- go -- handlebars -- haskell -- http -- ini -- java -- javascript -- json -- julia -- kotlin -- less -- lua -- makefile -- markdown -- nginx -- nim -- nix -- objectivec -- perl -- php -- plaintext -- properties -- python -- r -- ruby -- rust -- scala -- scss -- shell -- sql -- swift -- typescript -- x86asm -- xml -- yaml diff --git a/tests/gui/highlighting.goml b/tests/gui/highlighting.goml new file mode 100644 index 00000000..9674afa8 --- /dev/null +++ b/tests/gui/highlighting.goml @@ -0,0 +1,49 @@ +// This tests syntax highlighting. + +go-to: |DOC_PATH| + "highlighting/index.html" + +assert: "#apache ~ pre > code > span.hljs-comment" +assert: "#armasm ~ pre > code > span.hljs-symbol" +assert: "#bash ~ pre > code > span.hljs-meta" +assert: "#c ~ pre > code > span.hljs-meta" +assert: "#coffeescript ~ pre > code > span.hljs-title" +assert: "#cpp ~ pre > code > span.hljs-meta" +assert: "#csharp ~ pre > code > span.hljs-keyword" +assert: "#css ~ pre > code > span.hljs-keyword" +assert: "#d ~ pre > code > span.hljs-comment" +assert: "#diff ~ pre > code > span.hljs-comment" +assert: "#go ~ pre > code > span.hljs-keyword" +// Not clear why this doesn't have the hljs- prefix. +assert: "#handlebars ~ pre > code > span.xml" +assert: "#haskell ~ pre > code > span.hljs-title" +assert: "#http ~ pre > code > span.hljs-keyword" +assert: "#ini ~ pre > code > span.hljs-comment" +assert: "#java ~ pre > code > span.hljs-class" +assert: "#javascript ~ pre > code > span.hljs-function" +assert: "#json ~ pre > code > span.hljs-attr" +assert: "#julia ~ pre > code > span.hljs-comment" +assert: "#kotlin ~ pre > code > span.hljs-keyword" +assert: "#less ~ pre > code > span.hljs-keyword" +assert: "#lua ~ pre > code > span.hljs-comment" +assert: "#makefile ~ pre > code > span.hljs-comment" +assert: "#markdown ~ pre > code > span.hljs-section" +assert: "#nginx ~ pre > code > span.hljs-attribute" +assert: "#nim ~ pre > code > span.hljs-keyword" +assert: "#objectivec ~ pre > code > span.hljs-meta" +assert: "#nix ~ pre > code > span.hljs-keyword" +assert: "#perl ~ pre > code > span.hljs-keyword" +assert: "#php ~ pre > code > span.hljs-meta" +assert: "#properties ~ pre > code > span.hljs-comment" +assert: "#python ~ pre > code > span.hljs-meta" +assert: "#r ~ pre > code > span.hljs-keyword" +assert: "#ruby ~ pre > code > span.hljs-comment" +assert: "#rust ~ pre > code > span.hljs-function" +assert: "#scala ~ pre > code > span.hljs-comment" +assert: "#scss ~ pre > code > span.hljs-comment" +assert: "#shell ~ pre > code > span.hljs-meta" +assert: "#sql ~ pre > code > span.hljs-keyword" +assert: "#swift ~ pre > code > span.hljs-keyword" +assert: "#typescript ~ pre > code > span.hljs-keyword" +assert: "#x86asm ~ pre > code > span.hljs-meta" +assert: "#xml ~ pre > code > span.hljs-meta" +assert: "#yaml ~ pre > code > span.hljs-meta"