This article describes how to use Asciidoctor to format the document like a specification
The workflow is as follows:
- Installing Asciidoctor
- Preparing for coding
- Coding
- Generating a HTML file
- Operation check
Instructions for installing Asciidoctor are detailed in the [Asciidoctor Installation section] (https://asciidoctor.org/#installation). For macOS, you can install it with the following command.
brew install asciidoctor
Run the following command in the terminal to prepare for coding.
mkdir asciidoctor-requirement
cd asciidoctor-requirement
touch requirement.adoc
touch style.css
Open requirement.adoc in the editor and enter the following content.
Click to go to requirement.adoc.txt
Open style.css in the editor and enter the following content.
Run the following command in the terminal to generate a HTML file.
asciidoctor -a stylesheet=style.css -o dist/requirement.html requirement.adoc
Open the generated HTML file. If you use macOS, the following command is useful.
open dist/requirement.html
PDF output is also possible by using the print function of the browser. Firefox is recommended because it has a function to display the page number and the total number of pages in the footer.
I find it convenient that Asciidoctor can make detailed settings, such as putting numbers and captions in figures and tables. While simple Markdown is suitable for writing blog articles, the Asciidoctor is suitable for writing documents.
I wrote another article titled How to take screenshots with Puppeteer. The method described in that article is useful for automating screenshots, such as when you want to include a screen example in a requirements definition document. If you are interested, please read it as well.
I hope this article can help those who are tired of writing specs in Word. Thank you for reading!