https://github.com/quacksouls/honkit-plugin-exercise
Formatting exercises/problems in HonKit
https://github.com/quacksouls/honkit-plugin-exercise
gitbook gitbook-plugin honkit honkit-plugin javascript
Last synced: 8 months ago
JSON representation
Formatting exercises/problems in HonKit
- Host: GitHub
- URL: https://github.com/quacksouls/honkit-plugin-exercise
- Owner: quacksouls
- License: apache-2.0
- Created: 2023-05-22T04:37:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-23T01:33:44.000Z (over 2 years ago)
- Last Synced: 2025-01-16T16:59:39.856Z (about 1 year ago)
- Topics: gitbook, gitbook-plugin, honkit, honkit-plugin, javascript
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HonKit plugin: exercise
Formats and numbers each exercise. Numbering is automatic and starts at 1. An
exercise can be labelled to allow for cross-referencing.
## Installation
Install via npm:
```sh
npm install honkit-plugin-exercise --save-dev
```
Add the plugin to your `book.json`:
```js
{
plugins: [ "exercise" ]
}
```
## Usage
An exercise is added by the block:
```
{% exercise %}{% endexercise %}
Insert your exercise text here.
```
To help cross-reference an exercise, you can add a label. The label text should
not have any white spaces.
```
{% exercise label="my_label" %}{% endexercise %}
Insert your exercise text here.
```
For example, the following exercise blocks
```
{% exercise %}{% endexercise %}
What Is the airspeed velocity of an unladen swallow?
{% exercise label="a_label" %}{% endexercise %}
What do you mean? An African or a European swallow?
```
would be rendered as

Cross-reference an exercise like how you cross-reference a section in a Markdown
file. In the above example, the exercise having the label `"a_label"` can be
cross-referenced as:
```
[this exercise](/path/to/file.md#a_label)
```