GitHub flavored markdown does not provide any sort of definition lists, which is somewhat of a pain when it comes to documenting command line options and function parameters.
With pandoc(1)
, you can define definition lists with the following syntax
`callback`
:
Specifies the function which is called once the file read
is done with the following parameters:
`error`
:
Specifies the error object indicating which error
occurred, undefined if no error occurred.
`buffer`
:
Specifies the buffer containing the data read from
the file.
Which renders into the following html:
callback
Specifies the function which is called once the file read is done with the following parameters:
error
- Specifies the error object indicating which error occurred, undefined if no error occurred.
buffer
- Specifies the buffer containing the data read from the file.
If we change those definition lists terms into actual lists like the following:
* `callback`
:
Specifies the function which is called once the file read
is done with the following parameters:
* `error`
:
Specifies the error object indicating which error
occurred, undefined if no error occurred.
* `buffer`
:
Specifies the buffer containing the data read from
the file.
This will render into nested lists, and because two spaces are considered a hard line break. The definition list turns into space, colon, <br>
, which will render as the following:
Except for the bullet points it renders almost identical, most importantly, it's a very simple, global transformation that can easily be done with sed(1)
, the raw regex would look something like \*\s(.*\n.*\:\s{3})
.
Why not just keep the nested lists and style it accordingly? Well, semantics. In this case semantics matter when transforming to for example, groff.