You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+56-6Lines changed: 56 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -130,8 +130,10 @@ overlooked) job. We can always write better documentation!
130
130
131
131
In P4C, documentation is generated using Doxygen. The generated documentation depends on [Doxygen Awesome CSS](https://github.com/jothepro/doxygen-awesome-css). The documentation is dynamically updated and deployed on [GitHub Pages](https://p4lang.github.io/p4c/).
132
132
133
-
There are two main sources from which we generate documentation: comments
134
-
in the code and markup documents in the docs/doxygen directory.
133
+
Documentation is generated from two main sources: README files distributed
134
+
across the repository and comments within the code. The README files are
135
+
tagged with documentation inclusion notes to indicate their integration into
136
+
the P4 compiler documentation.
135
137
136
138
Code comments should capture the main intent of the implementation and
137
139
the "why", rather than the "how". The how can be read from the code,
@@ -150,14 +152,45 @@ XX is a number between 02-99. Currently, 00_revision_history.md
150
152
contains the documentation revision history, and 01_overview.md is the
151
153
overview of the compiler goals and architecture.
152
154
153
-
## Documentation Comments Style Guide
155
+
## C/C++ Documentation Comments Style Guide
154
156
- Use triple slashes `///` for documenting functions and classes in files.
155
157
- Double slashes `//` should be used for "internal" comments within functions.
156
158
- Double slashes `//` should be used for inline comment.
157
159
- For rare occasions such as adding comments to multi-line macros, you may use `/* ... */` style comments.
158
-
- There should be no space at the end of the comment.
159
-
- First letter of the comment should be a capital letter.
160
-
- Each comment should end with a period.
160
+
- Formatting:
161
+
- There should be no space at the end of the comment.
162
+
- First letter of the comment should be a capital letter.
163
+
- Each comment should end with a period.
164
+
165
+
## Building the Doxygen documentation
166
+
- Doxygen is configured in `docs/doxygen/doxygen.cfg`.
167
+
- The main HTML page is configured in `docs/doxygen/Doxymain.md`:
168
+
- CSS for the card effect is in `docs/assets/css/card.css`.
169
+
- The effect for the Easter egg toggle is defined in `docs/assets/css/flow.css`.
170
+
- The homepage P4C architecture is rendered using `docs/assets/architecture_unanimated.html`, with the editable draw file available at `docs/assets/Architecture.drawio`.
171
+
- Add pages and subpages manually to the sidebar (see `docs/doxygen/p4c_layout.xml`).
172
+
- TOCs in markdown files are created with the `[TOC]` command.
173
+
- The base style for Doxygen Awesome is described in the [Doxygen Awesome Documentation](https://jothepro.github.io/doxygen-awesome-css/) and the updated color scheme is defined in [`docs\assets\css\p4c_custom.css`](https://github.com/p4lang/p4c/blob/main/docs/assets/css/p4c_custom.css).
174
+
175
+
### Doxygen Comments Style Guide
176
+
- Comment Markup and Documentation Commands
177
+
-`<!-- ... -->` is used for adding documentation inclusion notes. This content is hidden from both the rendered Markdown and Doxygen, but visible in the raw view on GitHub.
178
+
- Use HTML comments with an exclamation mark to add instructions for Doxygen. These comments are hidden in GitHub's Markdown but processed by Doxygen. For example:
179
+
```
180
+
<!--!
181
+
\page changelog Releases
182
+
-->
183
+
```
184
+
-`\internal` and `\endinternal` commands within comments can be used to hide information from Doxygen while still displaying it on GitHub.
185
+
```
186
+
<!--!
187
+
\internal
188
+
-->
189
+
This section is hidden from Doxygen but will be visible on GitHub.
190
+
<!--!
191
+
\endinternal
192
+
-->
193
+
```
161
194
162
195
Happy writing! Should you have any questions, please don't hesitate to ask.
0 commit comments