Add Nim to default languages
Nim is a systems programming language (included in the highlight.js `system` group), and we're quite happily using `mdBook` in several of our documentation projects starting with our [style guide](https://status-im.github.io/nim-style-guide/). While we can maintain our own highlight.js, including `Nim` in the default distribution would allow us to promote more mdBook usage in the Nim community at the cost of a ~2kb increase in the `highlight.js` size.
This commit is contained in:
parent
94e0a44e15
commit
5c8941ba16
|
@ -148,7 +148,7 @@ The following are instructions for updating [highlight.js](https://highlightjs.o
|
||||||
1. Clone the repository at <https://github.com/highlightjs/highlight.js>
|
1. Clone the repository at <https://github.com/highlightjs/highlight.js>
|
||||||
1. Check out a tagged release (like `10.1.1`).
|
1. Check out a tagged release (like `10.1.1`).
|
||||||
1. Run `npm install`
|
1. Run `npm install`
|
||||||
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx properties r scala x86asm yaml`
|
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx nim properties r scala x86asm yaml`
|
||||||
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. 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. 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. 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.
|
||||||
|
|
|
@ -44,6 +44,7 @@ your own `highlight.js` file:
|
||||||
- makefile
|
- makefile
|
||||||
- markdown
|
- markdown
|
||||||
- nginx
|
- nginx
|
||||||
|
- nim
|
||||||
- objectivec
|
- objectivec
|
||||||
- perl
|
- perl
|
||||||
- php
|
- php
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,6 +27,7 @@ This Currently contains following languages
|
||||||
- makefile
|
- makefile
|
||||||
- markdown
|
- markdown
|
||||||
- nginx
|
- nginx
|
||||||
|
- nim
|
||||||
- objectivec
|
- objectivec
|
||||||
- perl
|
- perl
|
||||||
- php
|
- php
|
||||||
|
|
|
@ -529,6 +529,26 @@ http {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## nim
|
||||||
|
|
||||||
|
```nim
|
||||||
|
from strutils import `%`
|
||||||
|
|
||||||
|
const numDoors = 100
|
||||||
|
var doors {.compileTime.}: array[1..numDoors, bool]
|
||||||
|
|
||||||
|
proc calcDoors(): string =
|
||||||
|
for pass in 1..numDoors:
|
||||||
|
for door in countup(pass, numDoors, pass):
|
||||||
|
doors[door] = not doors[door]
|
||||||
|
for door in 1..numDoors:
|
||||||
|
result.add("Door $1 is $2.\n" % [$door, if doors[door]: "open" else: "closed"])
|
||||||
|
|
||||||
|
const outputString: string = calcDoors()
|
||||||
|
|
||||||
|
echo outputString
|
||||||
|
```
|
||||||
|
|
||||||
## objectivec
|
## objectivec
|
||||||
|
|
||||||
```objectivec
|
```objectivec
|
||||||
|
|
Loading…
Reference in New Issue