Skip to content

Commit 4db6c57

Browse files
authored
Add style guide, rework translation tooling, shift to single translation file. (#30)
1 parent 3597e3b commit 4db6c57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3974
-1501
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ repos:
1515
- id: ruff-check
1616
args: [ --fix ]
1717
- id: ruff-format
18+
- repo: https://github.com/rvben/rumdl-pre-commit
19+
rev: v0.0.136
20+
hooks:
21+
- id: rumdl
22+
args: [--force-exclude]

.pyspelling.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ matrix:
55
- docs/spelling_wordlist
66
output: _build/dictionary/python.dic
77
sources:
8-
- '**/*.md'
8+
- 'docs/**/*.md'
9+
- 'src/**/*.md'
910
pipeline:
1011
- pyspelling.filters.markdown:
1112
markdown_extensions:

.rumdl.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[global]
2+
flavor = "mkdocs"
3+
include = ["**/*.md"]
4+
exclude = ["docs/en/content_test_bed/*_include.md", "docs/en/SUMMARY.md"]
5+
respect-gitignore = true
6+
7+
# Disable rules:
8+
# MD013: Enforces line length
9+
# MD014: Forces commands in codeblocks to show output
10+
disable = ["MD013", "MD014",]
11+
12+
[MD033] # No inline HTML
13+
allowed_elements = ["nospell",] # pyspelling inline disable tag

docs/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ copyright: © Russell Keith-Magee
22

33
not_in_nav: |
44
/index.md
5+
shared_content/*.md
56
67
validation:
78
omitted_files: warn

docs/en/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
- [Section two](section_two/index.md)
55
- [Section three](section_three/index.md)
66
- ./section_three/*
7+
- Shared content test bed
8+
- [Shared content test bed](content_test_bed/index.md)
9+
- [Style guide](content_test_bed/style_guide_include.md)

docs/en/content_test_bed/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Shared content test bed
2+
3+
This section is included for the purposes of verifying the shared content provided from this repo for use in the rest of the BeeWare documentation. "Shared content" refers to documents or sections of documents that are common to multiple other repos. They are stored here for inclusion across those repos. This means there is a single source when updates are required, and that change will populate across all repos using that shared content.
4+
5+
If you are updating existing content, the following steps are not necessary. You can simply build the test site, and see your updates rendered.
6+
7+
If you are creating a new shared documentation file in the `shared-content` directory, complete the following:
8+
9+
1. Create a file in the `content_test_bed` that is the same filename as your new content file, with "_include" appended to the end.
10+
* For `style_guide.md`, you would add `style_guide_include.md`.
11+
2. Using the Snippets syntax, add the filename to `filename_include.md`. The Snippets syntax for including content is `-8<- "filename.md"`.
12+
* For `style_guide.md`, you would add `-8<- "style_guide.md"` to `style_guide_include.md`.
13+
3. Update the `Shared content test bed` section in `/docs/SUMMARY.md` to include the new `_include` file and path, at the same indentation level as the other items in that section.
14+
* For `style_guide_include.md`, you would add `- [Style guide](content_test_bed/style_guide_include.md)`.
15+
16+
Once these steps are completed, you can build the test site and view your new documentation rendered.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-8<- "style_guide.md"

docs/en/index.md

Lines changed: 21 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,37 @@
22

33
## Theme checklist
44

5-
This demo is designed to test the various features of the BeeWare
6-
MkDocs Material theme overrides. Please read through and verify
7-
that everything listed on this and the following pages is present
8-
and functioning as detailed in the description.
5+
This demo is designed to test the various features of the BeeWare MkDocs Material theme overrides. Please read through and verify that everything listed on this and the following pages is present and functioning as detailed in the description.
96

107
## Titlebar
118

12-
A medium-gray titlebar is on the page. This the theme template
13-
has been applied.
9+
A medium-gray titlebar is on the page. This the theme template has been applied.
1410

1511
## Header icon
1612

17-
The header icon top-left has been rendered. This confirms the template
18-
can reference external resources.
13+
The header icon top-left has been rendered. This confirms the template can reference external resources.
1914

2015
## Homepage sidebar icon
2116

22-
The logo icon in the left sidebar has been rendered. The logo should be
23-
the width of, and of equal height to, the sidebar. The site title should
24-
be rendered below it in slightly larger font than the rest of the
25-
sidebar, with the version number below it in smaller font.
17+
The logo icon in the left sidebar has been rendered. The logo should be the width of, and of equal height to, the sidebar. The site title should be rendered below it in slightly larger font than the rest of the sidebar, with the version number below it in smaller font.
2618

2719
This confirms the sidebar will render properly on the target sites.
2820

2921
## Heading font
3022

31-
Headings are rendered in Cutive. This confirms the BeeWare custom CSS
32-
theme has been applied.
23+
Headings are rendered in Cutive. This confirms the BeeWare custom CSS theme has been applied.
3324

3425
## Inline code
3526

36-
Inline code is rendered in the same color as the surrounding font. This
37-
confirms that the theme has not caused any undesired changes.
27+
Inline code is rendered in the same color as the surrounding font. This confirms that the theme has not caused any undesired changes.
3828

3929
This is text with `inline code` here and `inline code` here.
4030

4131
## Tabbed content code
4232

43-
Code is in a contrasting color to the background. Copy button should
44-
copy only the commands; the prompt should not be included.
33+
Code is in a contrasting color to the background. Copy button should copy only the commands; the prompt should not be included.
4534

46-
This confirms that the theme has not caused any undesired changes,
47-
as well as whether the copy button is working as expected.
35+
This confirms that the theme has not caused any undesired changes, as well as whether the copy button is working as expected.
4836

4937
/// tab | macOS
5038

@@ -72,16 +60,13 @@ C:\...>git clone https://github.com/beeware/beeware-theme.git
7260

7361
## Code copy button behavior
7462

75-
The copy button on the following codeblock should result in `from pathlib
76-
import Path` being copied to the clipboard.
63+
The copy button on the following codeblock should result in `from pathlib import Path` being copied to the clipboard.
7764

7865
```python
7966
from pathlib import Path
8067
```
8168

82-
The copy button on the following codeblock should result in `ls
83-
beeware-docs-tools` being copied to the clipboard. The shell prompt and
84-
the output should not be included.
69+
The copy button on the following codeblock should result in `ls beeware-docs-tools` being copied to the clipboard. The shell prompt and the output should not be included.
8570

8671
```console
8772
(venv) $ ls beeware-docs-tools
@@ -92,37 +77,25 @@ LICENSE README.md src
9277

9378
## Sidebar links
9479

95-
Sidebar links exist, and point to the `beeware-docs-tools` repo. This
96-
confirms that the sidebar content has been loaded, and the `project-name`
97-
has been set in the MkDocs configuration file, and the version number is
98-
computed and added.
80+
Sidebar links exist, and point to the `beeware-docs-tools` repo. This confirms that the sidebar content has been loaded, and the `project-name` has been set in the MkDocs configuration file, and the version number is computed and added.
9981

10082
## Link colors
10183

102-
This link to [the main BeeWare website](https://beeware.org) should be blue
103-
in *both* light mode and dark mode.
84+
This link to [the main BeeWare website](https://beeware.org) should be blue in *both* light mode and dark mode.
10485

10586
The links in the left and right sidebars should also be blue in both modes.
10687

107-
When scrolling down the page, the active header link in the right sidebar
108-
should be light blue in dark mode, and darker blue in light mode.
88+
When scrolling down the page, the active header link in the right sidebar should be light blue in dark mode, and darker blue in light mode.
10989

11090
## Translation admonition
11191

112-
The English-language version of this document should show the "Translations
113-
are available" admonition below. The French translation should show the "This is
114-
a machine translation!" admonition. The German translation should show the
115-
"This is a translation!" admonition for human translations.
92+
The English-language version of this document should show the "Translations are available" admonition below. The French translation should show the "This is a machine translation!" admonition. The German translation should show the "This is a translation!" admonition for human translations.
11693

11794
{% if config.extra.translation_type == "original" %}
11895

11996
/// admonition | Translations are available
12097

121-
If you're not comfortable with English, translations of the Docs Tools
122-
are available in
123-
[Français](https://beeware-docs-tools.readthedocs.io/fr/latest/)
124-
and
125-
[Deutsch](https://beeware-docs-tools.readthedocs.io/de/latest/).
98+
If you're not comfortable with English, translations of the Docs Tools are available in [Français](https://beeware-docs-tools.readthedocs.io/fr/latest/) and [Deutsch](https://beeware-docs-tools.readthedocs.io/de/latest/).
12699

127100
///
128101

@@ -132,9 +105,7 @@ and
132105

133106
/// admonition | This is a machine translation!
134107

135-
This version of the tutorial has been generated by machine translation.
136-
We know this isn't ideal, but we felt that a bad translation was better
137-
than no translation at all.
108+
This version of the tutorial has been generated by machine translation. We know this isn't ideal, but we felt that a bad translation was better than no translation at all.
138109

139110
///
140111

@@ -144,27 +115,20 @@ than no translation at all.
144115

145116
/// admonition | This is a translation!
146117

147-
This document is a translation of the English version. The translation
148-
has been reviewed by humans, but newer sections may be generated by
149-
machine translation, or not translated at all.
118+
This document is a translation of the English version. The translation has been reviewed by humans, but newer sections may be generated by machine translation, or not translated at all.
150119

151120
///
152121

153122
{% endif %}
154123

155124
## Custom 404 page
156125

157-
Add `nopage` to the end of the URL in your browser to verify the 404
158-
page contains two flying bees, and the text "Brutus can't find what
159-
you're looking for" below.
126+
Add `nopage` to the end of the URL in your browser to verify the 404 page exists, and includes the text "Brutus can't find what you're looking for". The current 404 page does not always render the images due to an issue with MkDocs.
160127

161-
*MkDocs builds fail with unrecognized internal links, so you need to
162-
manually verify this check by modifying the URL in your browser.*
128+
*MkDocs builds fail with unrecognized internal links, so you need to manually verify this check by modifying the URL in your browser.*
163129

164130
## Next checks
165131

166-
The following link should take you to BeeWare Docs Tools Demo Section
167-
One. It is included to verify cross-page linking.
132+
The following link should take you to BeeWare Docs Tools Demo Section One. It is included to verify cross-page linking.
168133

169-
Navigate to [BeeWare Docs Tools Demo Section One](section_one/index.md) for the
170-
next checks.
134+
Navigate to [BeeWare Docs Tools Demo Section One](section_one/index.md) for the next checks.

docs/en/section_one/index.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,19 @@
22

33
## Non-homepage sidebar logo
44

5-
The logo icon in the left sidebar should be small on all pages other than the
6-
homepage. The site title and version number should be rendered next to it with
7-
the site title in slightly larger font, and the version number in smaller font.
5+
The logo icon in the left sidebar should be small on all pages other than the homepage. The site title and version number should be rendered next to it with the site title in slightly larger font, and the version number in smaller font.
86

97
This verifies that the theme is being properly applied.
108

119
## Include external markdown from a local file
1210

13-
The following section should have only a header, and a paragraph with inline code
14-
followed by a code block. There should be no text between the code block and the
15-
next header. This verifies that the external include extension is working with
16-
local files.
11+
The following section should have only a header, and a paragraph with inline code followed by a code block. There should be no text between the code block and the next header. This verifies that the external include extension is working with local files.
1712

1813
-8<- "include_content.md:local-content"
1914

2015
## Include external markdown from a URL
2116

22-
The following section should have only a header, some text and a Markdown list.
23-
This verifies that the external include extension is working, and that
24-
`url_download` is enabled.
17+
The following section should have only a header, some text and a Markdown list. This verifies that the external include extension is working, and that `url_download` is enabled.
2518

2619
-8<-
2720
https://raw.githubusercontent.com/beeware/beeware-docs-tools/refs/heads/main/docs/include_content.md:remote-content

docs/en/section_one/page_two.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
# BeeWare Docs Tools Demo section one: page two
22

3-
### Footer and navigation links
3+
## Footer and navigation links
44

5-
Navigation should render at the bottom of the page; "BeeWare Docs Tools Demo
6-
Section One" should be on the left, "Section Two" should be on the right.
7-
The footer should be below the navigation links. This confirms the theme
8-
configuration has been applied.
5+
Navigation should render at the bottom of the page; "BeeWare Docs Tools Demo Section One" should be on the left, "Section Two" should be on the right. The footer should be below the navigation links. This confirms the theme configuration has been applied.
96

10-
### Class reference documentation
7+
## Class reference documentation
118

12-
The following should show the reference documentation for the `DocsTest`
13-
class, located in `docs_test.py`, in the `src/beeware_docs_tools`
14-
directory. This verifies that the source code directory symlinking is
15-
working properly.
9+
The following should show the reference documentation for the `DocsTest` class, located in `docs_test.py`, in the `src/beeware_docs_tools` directory. This verifies that the source code directory symlinking is working properly.
1610

1711
::: beeware_docs_tools.docs_test.DocsTest

0 commit comments

Comments
 (0)