Add a syntax-highlighting GUI test
This adds a test specific to highlight.js syntax highlighting.
This commit is contained in:
parent
dbad189b26
commit
f958a0e8cf
9 changed files with 58 additions and 53 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
3
tests/gui/books/highlighting/README.md
Normal file
3
tests/gui/books/highlighting/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Syntax Highlighting
|
||||
|
||||
This GUI test book is used for testing syntax highlighting.
|
||||
2
tests/gui/books/highlighting/book.toml
Normal file
2
tests/gui/books/highlighting/book.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[book]
|
||||
title = "Syntax Highlighting"
|
||||
3
tests/gui/books/highlighting/src/SUMMARY.md
Normal file
3
tests/gui/books/highlighting/src/SUMMARY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Summary
|
||||
|
||||
- [Languages](./languages.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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
49
tests/gui/highlighting.goml
Normal file
49
tests/gui/highlighting.goml
Normal file
|
|
@ -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"
|
||||
Loading…
Add table
Reference in a new issue