-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add polyglot code syntax highlighting for markdown code fences that specify a language. We support all of the [codemirror languages](https://github.com/codemirror/language-data). Co-authored-by: Martin Kavalar <martin@nextjournal.com>
- Loading branch information
1 parent
4312f4e
commit 49db167
Showing
11 changed files
with
169 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,69 @@ | ||
# 🤺 Markdown Fences | ||
## Handling Clojure blocks | ||
|
||
``` | ||
'(evaluated :and "highlighted") | ||
``` | ||
|
||
```clj | ||
'(evaluated :and "highlighted" :language clj) | ||
``` | ||
|
||
```clojure | ||
'(evaluated :and "highlighted") | ||
'(evaluated :and "highlighted" :language clojure) | ||
``` | ||
|
||
Use `{:nextjournal.clerk/code-listing true}` in the fence info to signal that a block should not be evaluated. | ||
|
||
```clojure {:nextjournal.clerk/code-listing true} | ||
'(1 2 "not evaluated" :but-still-highlighted) | ||
(1 2 "not evaluated" :but-still-highlighted) | ||
``` | ||
|
||
```clojure {:nextjournal.clerk/code-listing true} | ||
'(1 2 "not evaluated" :but-still-highlighted) | ||
## 🏳️🌈 Polyglot Highlighting | ||
|
||
EDN | ||
|
||
```edn | ||
(1 2 "not evaluated" :but-still-highlighted) | ||
``` | ||
|
||
Javascript | ||
|
||
```js | ||
() => { | ||
if (true) { | ||
return 'not evaluated' | ||
} else { | ||
return 'what' | ||
return 123 | ||
} | ||
} | ||
``` | ||
|
||
Python | ||
|
||
```py | ||
class Foo(object): | ||
def __init__(self): | ||
pass | ||
def do_this(self): | ||
return 1 | ||
``` | ||
|
||
C++ | ||
|
||
```c++ | ||
#include <iostream> | ||
|
||
int main() { | ||
std::cout << "Hello, world!" << std::endl; | ||
return 0; | ||
} | ||
``` | ||
|
||
## Indented Code Blocks | ||
[Indented code blocks](https://spec.commonmark.org/0.30/#indented-code-blocks) default to clojure highlighting | ||
|
||
(no (off) :fence) | ||
(but "highlighted") | ||
|
||
fin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters