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/oil_doc.py, which contains all the HTML plugins.

Related: How We Build Oil's Documentation.

Table of Contents
Link Shortcuts with $
Syntax Highlighting Specified In Front matter
Syntax Highlighting With Fenced Code Blocks
sh-prompt
oil-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: oil-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

oil-sh

A generic formatter that works for both shell and Oil code. It's used in idioms.html, known differences, and is now the default for the Oil 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

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

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-oil
$ echo one
one

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

Embeddings:


Generated on Wed May 3 15:38:09 EDT 2023