Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.

Examples of HTML Plugins

This file is essentially a unit test for doctools/oils_doc.py, which contains all the HTML plugins.

Related: How We Build Oils Documentation.

Table of Contents
Link Shortcuts with $
Syntax Highlighting Specified In Front matter
Syntax Highlighting With Fenced Code Blocks
sh-prompt
oils-sh
none (Explicit Override)
Pygments Lexers
Plugins We Should Have

Link Shortcuts with $

Syntax Highlighting Specified In Front matter

If every pre block in a document needs the same highlighter, you can specify it in the front matter like this:

---
default_highlighter: oils-sh
---

My Title
========

Syntax Highlighting With Fenced Code Blocks

sh-prompt

Highlights the $ line. For example, this input

```sh-prompt
$ echo hi   # comment
hi
```

produces

$ echo hi   # comment
hi

oils-sh

A generic formatter that works for both shell and YSH code. It's used in idioms.html, known differences, and is now the default for the Oils blog.

(Detail: it's the same as sh-prompt for now. We might want to do something smarter.)

none (Explicit Override)

To override the default highlighter with none:

```none
$ echo 'no syntax highlighting'
```

Result:

$ echo 'no syntax highlighting'

Pygments Lexers

Use any pygments lexer:

```python
x = 42
print(x, file=sys.stderr)
```

produces

Plugins We Should Have

A shell session could look like this:

```session-bash
$ echo one
one

$ for x in foo bar; do
>   echo $x
> done
foo
bar
```

or

```session-ysh
$ echo one
one

$ for x in foo bar {
>   echo $x
> }
foo
bar
```

Embeddings:

Generated on Mon, 11 Nov 2024 05:33:15 +0000