Skip to content

Commit d9c04cd

Browse files
camelidnotriddle
authored andcommitted
List supported Highlight.js languages in guide (rust-lang#1345)
* List supported Highlight.js languages in guide Generated using the technique described in rust-lang#1275 (comment). * Improve wording in guide
1 parent 43633e8 commit d9c04cd

File tree

3 files changed

+60
-9
lines changed

3 files changed

+60
-9
lines changed

guide/src/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- [Syntax highlighting](format/theme/syntax-highlighting.md)
1818
- [Editor](format/theme/editor.md)
1919
- [MathJax Support](format/mathjax.md)
20-
- [mdBook specific features](format/mdbook.md)
20+
- [mdBook-specific features](format/mdbook.md)
2121
- [Continuous Integration](continuous-integration.md)
2222
- [For Developers](for_developers/README.md)
2323
- [Preprocessors](for_developers/preprocessors.md)

guide/src/format/mdbook.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# mdBook-specific markdown
1+
# mdBook-specific features
22

33
## Hiding code lines
44

55
There is a feature in mdBook that lets you hide code lines by prepending them
6-
with a `#` [in the same way that Rustdoc does][rustdoc-hide].
6+
with a `#` [like you would with Rustdoc][rustdoc-hide].
77

88
[rustdoc-hide]: https://doc.rust-lang.org/stable/rustdoc/documentation-tests.html#hiding-portions-of-the-example
99

@@ -37,7 +37,7 @@ With the following syntax, you can include files into your book:
3737

3838
The path to the file has to be relative from the current source file.
3939

40-
mdBook will interpret included files as markdown. Since the include command
40+
mdBook will interpret included files as Markdown. Since the include command
4141
is usually used for inserting code snippets and examples, you will often
4242
wrap the command with ```` ``` ```` to display the file contents without
4343
interpretting them.

guide/src/format/theme/syntax-highlighting.md

+56-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,67 @@
11
# Syntax Highlighting
22

3-
For syntax highlighting I use [Highlight.js](https://highlightjs.org) with a
4-
custom theme.
3+
mdBook uses [Highlight.js](https://highlightjs.org) with a custom theme
4+
for syntax highlighting.
55

66
Automatic language detection has been turned off, so you will probably want to
7-
specify the programming language you use like this
7+
specify the programming language you use like this:
88

9-
<pre><code class="language-markdown">```rust
9+
~~~markdown
10+
```rust
1011
fn main() {
1112
// Some code
1213
}
13-
```</code></pre>
14+
```
15+
~~~
16+
17+
## Supported languages
18+
19+
These languages are supported by default, but you can add more by supplying
20+
your own `highlight.js` file:
21+
22+
- apache
23+
- armasm
24+
- bash
25+
- c
26+
- coffeescript
27+
- cpp
28+
- csharp
29+
- css
30+
- d
31+
- diff
32+
- go
33+
- handlebars
34+
- haskell
35+
- http
36+
- ini
37+
- java
38+
- javascript
39+
- json
40+
- julia
41+
- kotlin
42+
- less
43+
- lua
44+
- makefile
45+
- markdown
46+
- nginx
47+
- objectivec
48+
- perl
49+
- php
50+
- plaintext
51+
- properties
52+
- python
53+
- r
54+
- ruby
55+
- rust
56+
- scala
57+
- scss
58+
- shell
59+
- sql
60+
- swift
61+
- typescript
62+
- x86asm
63+
- xml
64+
- yaml
1465

1566
## Custom theme
1667
Like the rest of the theme, the files used for syntax highlighting can be

0 commit comments

Comments
 (0)