|
| 1 | += RISC-V Documentation Developer Guide |
| 2 | + |
| 3 | +This repo contains useful information for using AsciiDoc to write RISC-V specifications. |
| 4 | + |
| 5 | +A simple template for beginning a RISC-V specification can be found here: https://github.com/riscv/docs-spec-template |
| 6 | + |
| 7 | +== License |
| 8 | + |
| 9 | +This work is licensed under a Creative Commons Attribution 4.0 International License (CC-BY-4.0). For details, see the link:LICENSE[LICENSE] file. |
| 10 | + |
| 11 | +== Maintainers |
| 12 | + |
| 13 | +The list of maintainers of this repo is maintained in the link:MAINTAINERS.md[MAINTAINERS] file. |
| 14 | + |
| 15 | +== Contributors |
| 16 | + |
| 17 | +The list of contributors to this document is maintained in the link:src/contributors.adoc[contributors] file. |
| 18 | + |
| 19 | +For guidelines on how to contribute, refer to the link:CONTRIBUTING.md[CONTRIBUTING] file. |
| 20 | + |
| 21 | +== Governance |
| 22 | + |
| 23 | +The governance for this project is defined in the link:GOVERNANCE.md[GOVERNANCE] file. |
| 24 | + |
| 25 | +Community information, including meeting (if held) and mailing lists are detailed in this file. |
| 26 | + |
| 27 | +== Building the Document |
| 28 | + |
| 29 | +=== Directory Structure |
| 30 | + |
| 31 | +The following directories are used to organize the contents of this repo: |
| 32 | + |
| 33 | +* `dependencies/`: software dependencies needed to build the specification |
| 34 | +* `docs-resources/`: resources for all specifications sourced from link:.gitmodules[git submodule] |
| 35 | +* `src/`: source files for the specification |
| 36 | +* `build/`: default directory where the build artifacts are generated |
| 37 | + |
| 38 | +=== Prerequisites |
| 39 | + |
| 40 | +To build the document, you'll need the following tools installed on your system: |
| 41 | + |
| 42 | +* Make |
| 43 | +* asciiDoctor-pdf, asciidoctor-bibtex, asciidoctor-diagram, and asciidoctor-mathematical |
| 44 | +* Docker |
| 45 | + |
| 46 | +=== Cloning the Repository |
| 47 | + |
| 48 | +```shell |
| 49 | +git clone --recurse-submodules https://github.com/riscv/docs-spec-template.git |
| 50 | +``` |
| 51 | + |
| 52 | +All in one single line: |
| 53 | + |
| 54 | +```shell |
| 55 | +git clone --recurse-submodules https://github.com/riscv/docs-spec-template.git && cd docs-spec-template && git submodule update --init --recursive |
| 56 | + |
| 57 | +``` |
| 58 | + |
| 59 | +=== Building the Documentation |
| 60 | + |
| 61 | +To start the build process, run: |
| 62 | + |
| 63 | +```shell |
| 64 | +cd ./docs-spec-template && make build |
| 65 | +``` |
| 66 | + |
| 67 | +The link:Makefile[] script will check the availability of Docker on your system: |
| 68 | + |
| 69 | +* If Docker is available, the documentation will be built inside a Docker container using the image riscvintl/riscv-docs-base-container-image:latest. This ensures a consistent build environment across different systems. |
| 70 | +* If Docker is not available, the documentation will be built directly on your system using the installed tools. |
| 71 | + |
| 72 | +The documentation is generated from the AsciiDoctor source files in your project. The primary source file is specified by the `HEADER_SOURCE` variable in the Makefile. |
| 73 | + |
| 74 | +The build process utilizes several options, including theming and font settings, and generates a PDF document as output. |
| 75 | + |
| 76 | +=== Cleaning up |
| 77 | + |
| 78 | +To clean up the generated files, run: |
| 79 | + |
| 80 | +```shell |
| 81 | +make clean |
| 82 | +``` |
| 83 | + |
| 84 | +== Enabling pre-commit checks locally |
| 85 | + |
| 86 | +The repository has some basic commit checks set up with https://pre-commit.com/[pre-commit] that will be enforced by the GitHub CI. |
| 87 | +To ensure these checks are also run in the local repository while making changes the following can be done: |
| 88 | + |
| 89 | +.Installing pre-commit tool |
| 90 | +[source,shell] |
| 91 | +---- |
| 92 | +# Do once on your system |
| 93 | +pip3 install pre-commit |
| 94 | +---- |
| 95 | + |
| 96 | +.Installing pre-commit git hook in repo |
| 97 | +[source,shell] |
| 98 | +---- |
| 99 | +# Do once in local repo |
| 100 | +pre-commit install |
| 101 | +---- |
| 102 | + |
| 103 | +Rather than doing the above `pre-commit install` in every repo that uses it, you can do it https://pre-commit.com/#automatically-enabling-pre-commit-on-repositories[once on your system.] |
| 104 | + |
| 105 | +When enabling additional checks https://pre-commit.com/#plugins[by editing .pre-commit-config.yaml], it is recommended running the newly added check on all files in the repository. This can be done with the following command: |
| 106 | + |
| 107 | +.Running all pre-commit hooks on all files |
| 108 | +[source,shell] |
| 109 | +---- |
| 110 | +pre-commit run --all-files |
| 111 | +---- |
0 commit comments