Skip to content

Commit 4762b5f

Browse files
Anton Schwarzbari12
authored andcommitted
Tools: Rucio-Processor for markdown allows dark mode tables
The pipeline for the creation of the rucio-docs for the client API is as follows: * begin process using `build_documentation.sh` * `generate_dynamic_files.sh` spins up a docker container * inside of the docker container, `generate_docs.sh` is called * which in turn calls `generate_client_api_docs.sh` * `generate_client_api_docs.sh` parses the files in `lib/rucio/client` and converts them using `pydoc-markdown`. * `pydoc-markdown` uses `rucio_processor.py` and `rucio_renderer.py` (both in `tools/run_in_docker`, which is mounted into the docker container). * "auto_generated" output markdown files' ownerships are changed * compiling this markdown into html -> completed using docusaurus as part of the github action The final stage adds styling (i.e. CSS) to the compiled markdown files. This means that in general, a dark mode can be applied. However, some components in the client api are formatted in pre-styled HTML tables (within the markdown!), these styles are never overridden. As discussed with @bari12, a simple fix to the missing dark mode is proposed here. Instead of reworking the markdown to use plain markdown-tables which are styled at the appropriate (docusaurus) step (and not HTML tables that come with their own style), we reference a docusaurus CSS variable `--ifm-background-color`, which will set the correct dark mode colour (depending on whether dark or light mode is requested). We are aware of the fact that in doing so, we reference a variable several steps before it is defined. In addition, we add even more complicated HTML/CSS syntax to markdown, which is supposed to be easy on human eyes. The benefit of this fix is that it is minimally-invasive, and that the markdown files are never supposed to be served by themselves and only act as a middle step for the entire pipeline.
1 parent d483256 commit 4762b5f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

tools/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,31 @@ flowchart TD
3131
rest_api_docs-->rest_api_docs_html[Generate Rest Api Docs Html]
3232
```
3333

34+
Following this, a Github Action calls `yarn build`, which runs docusaurus (the
35+
tool which takes the markdown files and converts them into HTML)
36+
37+
### Building the Docs for the Client API
38+
The pipeline for the creation of the rucio-docs for the client API is as
39+
follows:
40+
41+
* begin process using `build_documentation.sh`
42+
* `generate_dynamic_files.sh` spins up a docker container
43+
* inside of the docker container, `generate_docs.sh` is called
44+
* which in turn calls `generate_client_api_docs.sh`
45+
* `generate_client_api_docs.sh` parses the files in `lib/rucio/client`
46+
and converts them using `pydoc-markdown`.
47+
* `pydoc-markdown` uses `rucio_processor.py` and `rucio_renderer.py`
48+
(both in `tools/run_in_docker`, which is mounted into the docker
49+
container).
50+
* "auto_generated" output markdown files' ownerships are changed
51+
* compiling this markdown into html -> completed using docusaurus as
52+
part of the github action
53+
54+
The final stage adds styling (i.e. CSS) to the compiled markdown files.
55+
This means that in general, a dark mode can be applied. However, some
56+
components in the client api are formatted in pre-styled HTML tables
57+
(within the markdown!), these styles are never overridden.
58+
3459
## Check Repository Health
3560

3661
The repository has several scripts to check the health of files. These include:

tools/run_in_docker/rucio_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ def generate_sections_markdown(sections):
6464
ret.append("\n<tr style={{border: 'none'}}>\n")
6565

6666
ret.append(
67-
"\n<td style={{border: 'none', backgroundColor: 'white', 'verticalAlign': 'top'}}>\n" # noqa: E501
67+
"\n<td style={{border: 'none', backgroundColor: 'var(--ifm-background-color)', 'verticalAlign': 'top'}}>\n" # noqa: E501
6868
)
6969
ret.append(f"**{key}**:")
7070
ret.append("\n</td>\n")
7171

7272
ret.append(
73-
"\n<td style={{border: 'none', backgroundColor: 'white', 'verticalAlign': 'top'}}>\n" # noqa: E501
73+
"\n<td style={{border: 'none', backgroundColor: 'var(--ifm-background-color)', 'verticalAlign': 'top'}}>\n" # noqa: E501
7474
)
7575
ret.extend(section)
7676
ret.append("\n</td>\n")

0 commit comments

Comments
 (0)