An open API service indexing awesome lists of open source software.

https://github.com/jaygooby/jekyll-permalink-for-fenced-code-blocks


https://github.com/jaygooby/jekyll-permalink-for-fenced-code-blocks

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# Description

Adds unique IDs to each fenced code block, so

````
```
echo "wat"
```
````

will render in html as

```

echo "wat"

```

And then you can link to it using `` or add a [ClipboardJS](https://clipboardjs.com) hook using the `#code-1` ID attribute.

# Usage

Drop `permalink-for-fenced-code-blocks.rb` into your Jekyll `_plugins` folder. By default, you'll also get a `` element for each code block, that looks like:

```
copy to clipboard
```

which you can hook up with [ClipboardJS](https://clipboardjs.com/#usage). If you don't want this `button` element, start Jekyll like this:

```
NO_COPY_BUTTON=1 jekyll serve -w
```