Skip to content

Commit dc21f14

Browse files
authored
Merge pull request #2232 from arnetheduck/add-nim
Add Nim to default languages
2 parents 94e0a44 + 5c8941b commit dc21f14

File tree

5 files changed

+71
-2
lines changed

5 files changed

+71
-2
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ The following are instructions for updating [highlight.js](https://highlightjs.o
148148
1. Clone the repository at <https://github.com/highlightjs/highlight.js>
149149
1. Check out a tagged release (like `10.1.1`).
150150
1. Run `npm install`
151-
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx properties r scala x86asm yaml`
151+
1. Run `node tools/build.js :common apache armasm coffeescript d handlebars haskell http julia nginx nim properties r scala x86asm yaml`
152152
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`.
153153
1. Copy `build/highlight.min.js` to mdbook's directory [`highlight.js`](https://github.com/rust-lang/mdBook/blob/master/src/theme/highlight.js).
154154
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.

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

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ your own `highlight.js` file:
4444
- makefile
4545
- markdown
4646
- nginx
47+
- nim
4748
- objectivec
4849
- perl
4950
- php

src/theme/highlight.js

+48-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_book/src/languages/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This Currently contains following languages
2727
- makefile
2828
- markdown
2929
- nginx
30+
- nim
3031
- objectivec
3132
- perl
3233
- php

test_book/src/languages/highlight.md

+20
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,26 @@ http {
529529
}
530530
```
531531

532+
## nim
533+
534+
```nim
535+
from strutils import `%`
536+
537+
const numDoors = 100
538+
var doors {.compileTime.}: array[1..numDoors, bool]
539+
540+
proc calcDoors(): string =
541+
for pass in 1..numDoors:
542+
for door in countup(pass, numDoors, pass):
543+
doors[door] = not doors[door]
544+
for door in 1..numDoors:
545+
result.add("Door $1 is $2.\n" % [$door, if doors[door]: "open" else: "closed"])
546+
547+
const outputString: string = calcDoors()
548+
549+
echo outputString
550+
```
551+
532552
## objectivec
533553

534554
```objectivec

0 commit comments

Comments
 (0)