Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Spinx starter pack for RTD site (ISD-2738) #16

Merged
merged 42 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6cf7cd2
enable starter pack
erinecon Nov 26, 2024
e241ffc
customize the setup
erinecon Nov 26, 2024
f1876a6
update home page
erinecon Nov 26, 2024
2db065b
update working directory in CI workflows
erinecon Nov 27, 2024
68ce33a
update hardcoded sphinx venv dir
erinecon Nov 27, 2024
ebe5cd5
update environment variables in Makefile
erinecon Nov 27, 2024
c016162
update environment variables
erinecon Nov 28, 2024
ac27f0c
un-hardcode directory
erinecon Nov 28, 2024
f966ec8
un-hardcode another directory
erinecon Nov 28, 2024
c4a3cc6
revert env var changes
erinecon Nov 28, 2024
0cb39d0
add navigational structure for tutorials, how-to's, explanations
erinecon Nov 28, 2024
5cc5bac
update how to contribute page
erinecon Nov 29, 2024
72c8849
navigation changes
erinecon Nov 29, 2024
929a06a
update contributing guide
erinecon Nov 29, 2024
8b31d1d
update linkcheck ignore list
erinecon Nov 29, 2024
d708d92
update custom spelling list
erinecon Nov 29, 2024
35b26a5
update changelog
erinecon Nov 29, 2024
2655475
update README for markdown-lint
erinecon Nov 29, 2024
524679e
make woke happy
erinecon Nov 29, 2024
41238ac
Apply suggestions from code review
erinecon Nov 29, 2024
b5e5739
move license info in .sh riles
erinecon Nov 29, 2024
613f432
update license yaml
erinecon Nov 29, 2024
980a4c3
remove license info from metrics sh
erinecon Nov 29, 2024
2d683a2
update license ignore yaml
erinecon Nov 29, 2024
def09a7
move changelog entry under unreleased
erinecon Dec 2, 2024
590f9e5
update ubuntu os version for RTD
erinecon Dec 2, 2024
aced8cc
update python version for RTD
erinecon Dec 2, 2024
d12f8ba
update line_length
erinecon Dec 2, 2024
47b6ce5
add markdown cheat sheet
erinecon Dec 2, 2024
d6ee53e
make lint test happy
erinecon Dec 2, 2024
a062cf8
fix unit test
erinecon Dec 2, 2024
128f5e5
update unit test installation script
erinecon Dec 2, 2024
bedf419
revert changes for unit test
erinecon Dec 2, 2024
2051917
trigger CI
erinecon Dec 4, 2024
b64c228
update .wokeignore file path
erinecon Dec 5, 2024
eef4443
update .woke.yaml ignore_files
erinecon Dec 5, 2024
ed7d666
revert changes in .wokeignore
erinecon Dec 5, 2024
e38dbfa
revert .woke.yaml changes, add files to .gitignore
erinecon Dec 5, 2024
841e04b
add docs files to root .gitignore
erinecon Dec 5, 2024
d706b57
try to make vale happy
erinecon Dec 5, 2024
130b21f
update spellcheck to US English, update docs
erinecon Dec 6, 2024
c116491
revert changes to .gitignore
erinecon Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,9 @@ cython_debug/
*.charm
*.rock
!examples/**/lib

# Docs-related files
docs/doc-cheat-sheet-myst.md
docs/doc-cheat-sheet.rst
docs/.sphinx/latex_elements_template.txt
erinecon marked this conversation as resolved.
Show resolved Hide resolved

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## 2024-11-29

### Changes

Added a `docs` folder to hold the
[Canonical Sphinx starter pack](https://github.com/canonical/sphinx-docs-starter-pack)
and to eventually publish the docs on Read the Docs.

## [Unreleased]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ Additional resources:
* [Tutorial to build a rock for a Flask application](https://documentation.ubuntu.com/rockcraft/en/latest/tutorial/flask/)
* [Charmcraft `flask-framework` reference](https://juju.is/docs/sdk/charmcraft-extension-flask-framework)
* [Charmcraft `flask-framework` how to guides](https://juju.is/docs/sdk/build-a-paas-charm)
* [Rockcraft `flask-framework` reference](https://documentation.ubuntu.com/rockcraft/en/latest/reference/extensions/flask-framework/)
* [Rockcraft`flask-framework`
reference](https://documentation.ubuntu.com/rockcraft/en/latest/reference/extensions/flask-framework/)

## Contributing

Expand Down
5 changes: 4 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ __pycache__
.vscode/
.sphinx/styles/*
.sphinx/vale.ini
sp-docs/_build
sp-docs/_build
doc-cheat-sheet-myst.md
doc-cheat-sheet.rst
erinecon marked this conversation as resolved.
Show resolved Hide resolved
.sphinx/latex_elements_template.txt
4 changes: 2 additions & 2 deletions docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.13"
jobs:
pre_install:
- git fetch --unshallow || true
Expand Down
4 changes: 2 additions & 2 deletions docs/.sphinx/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"default": false,
"MD003": { "style": "atx" },
"MD013": { "code_blocks": false, "tables": false, "stern": true, "line_length": 150},
"MD013": { "code_blocks": false, "tables": false, "stern": true, "line_length": 120},
"MD014": true,
"MD018": true,
"MD022": true,
Expand All @@ -13,4 +13,4 @@
"MD042": true,
"MD045": true,
"MD052": true
}
}
8 changes: 4 additions & 4 deletions docs/.sphinx/latex_elements_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
'pointsize': '11pt',
'fncychap': '',
'preamble': r'''
%\usepackage{charter}
%\usepackage[defaultsans]{lato}
%\usepackage{inconsolata}
% \usepackage{charter}

Check warning on line 6 in docs/.sphinx/latex_elements_template.txt

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: % Raw Output: {"message": "[Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: %", "location": {"path": "docs/.sphinx/latex_elements_template.txt", "range": {"start": {"line": 6, "column": 1}}}, "severity": "WARNING"}
% \usepackage[defaultsans]{lato}

Check warning on line 7 in docs/.sphinx/latex_elements_template.txt

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: % Raw Output: {"message": "[Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: %", "location": {"path": "docs/.sphinx/latex_elements_template.txt", "range": {"start": {"line": 7, "column": 1}}}, "severity": "WARNING"}
% \usepackage{inconsolata}

Check warning on line 8 in docs/.sphinx/latex_elements_template.txt

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: % Raw Output: {"message": "[Canonical.015-No-prompts-in-comments] Avoid using prompts in code blocks: %", "location": {"path": "docs/.sphinx/latex_elements_template.txt", "range": {"start": {"line": 8, "column": 1}}}, "severity": "WARNING"}
\setmainfont[UprightFont = *-R, BoldFont = *-B, ItalicFont=*-RI, Extension = .ttf]{Ubuntu}
\setmonofont[UprightFont = *-R, BoldFont = *-B, ItalicFont=*-RI, Extension = .ttf]{UbuntuMono}
\usepackage[most]{tcolorbox}
Expand Down Expand Up @@ -116,4 +116,4 @@
\end{tikzpicture}
}
''',
}
}
2 changes: 1 addition & 1 deletion docs/.sphinx/spellingcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ matrix:
- name: rST files
aspell:
lang: en
d: en_GB
d: en_US
dictionary:
wordlists:
- .sphinx/.wordlist.txt
Expand Down
273 changes: 273 additions & 0 deletions docs/doc-cheat-sheet-myst.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
---
orphan: true
myst:
substitutions:
reuse_key: "This is **included** text."
advanced_reuse_key: "This is a substitution that includes a code block:
```
code block
```"
---

<!-- vale off -->

(cheat-sheet-myst)=
# Markdown/MyST cheat sheet

<!-- vale on -->

This file contains the syntax for commonly used Markdown and MyST markup.
Open it in your text editor to quickly copy and paste the markup you need.

See the [MyST style guide](https://canonical-documentation-with-sphinx-and-readthedocscom.readthedocs-hosted.com/style-guide-myst/) for detailed information and conventions.

Also see the [MyST documentation](https://myst-parser.readthedocs.io/en/latest/index.html) for detailed information on MyST, and the [Canonical Documentation Style Guide](https://docs.ubuntu.com/styleguide/en) for general style conventions.

## H2 heading

Content.

### H3 heading

Content.

#### H4 heading

Content.

##### H5 heading

Content.

## Inline formatting

- {guilabel}`UI element`
- `code`
- {command}`command`
- {kbd}`Key`
- *Italic*
- **Bold**

## Code blocks

Start a code block:

code:
- example: true

Demonstrate a code block:

```
code:
- example: true
```

Demonstrate a code block (yaml):

```yaml
code:
- example: true
```

(a_section_target_myst)=
## Links

- [Canonical website](https://canonical.com/)
- {ref}`a_section_target_myst`
- {ref}`Link text <a_section_target_myst>`
- {doc}`index`
- {doc}`Link text <index>`

## Navigation

Use the following syntax::

```{toctree}
:hidden:

sub-page1
sub-page2
```

## Lists

1. Step 1
- Item 1
* Sub-item
- Item 2
1. Sub-step 1
1. Sub-step 2
1. Step 2
1. Sub-step 1
- Item
1. Sub-step 2

Term 1
: Definition

Term 2
: Definition

## Tables

Demonstrate different kinds of tables.

## Markdown tables

| Header 1 | Header 2 |
|------------------------------------|----------|
| Cell 1<br>Second paragraph | Cell 2 |
| Cell 3 | Cell 4 |

Centred:

| Header 1 | Header 2 |
|:----------------------------------:|:--------:|
| Cell 1<br>Second paragraph | Cell 2 |
| Cell 3 | Cell 4 |

## List tables

```{list-table}
:header-rows: 1

* - Header 1
- Header 2
* - Cell 1

Second paragraph
- Cell 2
* - Cell 3
- Cell 4
```

Centred:

```{list-table}
:header-rows: 1
:align: center

* - Header 1
- Header 2
* - Cell 1

Second paragraph
- Cell 2
* - Cell 3
- Cell 4
```

## Notes

```{note}
A note.
```

```{tip}
A tip.
```

```{important}
Important information
```

```{caution}
This might damage your hardware!
```

Check warning on line 176 in docs/doc-cheat-sheet-myst.md

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.016-No-inline-comments] Avoid inline comments in code blocks. Raw Output: {"message": "[Canonical.016-No-inline-comments] Avoid inline comments in code blocks.", "location": {"path": "docs/doc-cheat-sheet-myst.md", "range": {"start": {"line": 176, "column": 1}}}, "severity": "WARNING"}

## Images

![Alt text](https://assets.ubuntu.com/v1/b3b72cb2-canonical-logo-166.png)

```{figure} https://assets.ubuntu.com/v1/b3b72cb2-canonical-logo-166.png
:width: 100px
:alt: Alt text

Figure caption
```

## Reuse

Check warning on line 189 in docs/doc-cheat-sheet-myst.md

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.011-Headings-not-followed-by-heading] Avoid stacked headings. There should be content for each heading. Raw Output: {"message": "[Canonical.011-Headings-not-followed-by-heading] Avoid stacked headings. There should be content for each heading.", "location": {"path": "docs/doc-cheat-sheet-myst.md", "range": {"start": {"line": 189, "column": 1}}}, "severity": "WARNING"}

### Keys

Keys can be defined at the top of a file, or in a `myst_substitutions` option in `conf.py`.

{{reuse_key}}

{{advanced_reuse_key}}

### File inclusion

```{include} index.md
:start-after: include_start
:end-before: include_end
```

## Tabs

````{tabs}
```{group-tab} Tab 1

Content Tab 1
```

```{group-tab} Tab 2
Content Tab 2
```
````

## Glossary

```{glossary}

some term
Definition of the example term.
```

{term}`some term`

## More useful markup

- ```{versionadded} X.Y
- {abbr}`API (Application Programming Interface)`

----

## Custom extensions

Related links at the top of the page (surrounded by `---`):

relatedlinks: https://github.com/canonical/lxd-sphinx-extensions, [RTFM](https://www.google.com)
discourse: 12345

Terms that should not be checked by the spelling checker: {spellexception}`PurposelyWrong`

A single-line terminal view that separates input from output:

```{terminal}
:input: command
:user: root
:host: vampyr
:dir: /home/user/directory/

the output
```

A multi-line version of the same:

```{terminal}
:user: root
:host: vampyr
:dir: /home/user/directory/

:input: command 1
output 1
:input: command 2
output 2
```

Check warning on line 267 in docs/doc-cheat-sheet-myst.md

View workflow job for this annotation

GitHub Actions / unit-tests / Style checker

[vale] reported by reviewdog 🐶 [Canonical.016-No-inline-comments] Avoid inline comments in code blocks. Raw Output: {"message": "[Canonical.016-No-inline-comments] Avoid inline comments in code blocks.", "location": {"path": "docs/doc-cheat-sheet-myst.md", "range": {"start": {"line": 267, "column": 1}}}, "severity": "WARNING"}

A link to a YouTube video:

```{youtube} https://www.youtube.com/watch?v=iMLiK1fX4I0
:title: Demo
```
6 changes: 4 additions & 2 deletions docs/doc-cheat-sheet.rst
erinecon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ Start a code block::
code:
- example: true

Demonstrate a code block:

.. code::

# Demonstrate a code block
code:
- example: true

Demonstrate a code block (yaml):

.. code:: yaml

# Demonstrate a code block
code:
- example: true

Expand Down
Loading
Loading