Skip to content

Commit d640423

Browse files
authored
Merge pull request #104 from coderefinery/rkdarst/various-revisions
Emphasize MyST, various other improvements
2 parents d6da11f + 04e8204 commit d640423

19 files changed

+225
-132
lines changed

content/building.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
# Building the lesson
22

3-
It is built the normal Sphinx way:
3+
```{highlight} console
4+
```
5+
6+
It is built the normal Sphinx ways. Using Sphinx directly, one would
7+
run:
8+
9+
```
10+
$ sphinx-build -M html content/ _build
11+
```
12+
13+
If you have `make` installed, you can:
414

515
```
6-
make html
7-
# or
8-
make dirhtml
9-
# full build
10-
make clean html
16+
$ make html
17+
## or
18+
$ make dirhtml
19+
## full build
20+
$ make clean html
1121
```
1222

13-
However, there are different ways to set up a Sphinx project. Our
14-
sample project puts the results in `_build/`.
23+
However, there are different ways to set up a Sphinx project.
24+
CodeRefinery lessons puts the results in `_build/`.

content/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
This isn't very up to date right now. There haven't been significant
4+
backwards-incompatible changes, so this hasn't been kept in earnest.
5+
36
## 0.8.0
47

58
- First PyPI release

content/cheatsheet.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Cheatsheet
22

3-
This is the cheatsheet.
3+
Nothing here yet. See the sample episodes:
4+
5+
* [MyST markdown](https://github.com/coderefinery/sphinx-lesson/blob/master/content/sample-episode-myst.md?plain=1)
6+
* [ReST](https://github.com/coderefinery/sphinx-lesson/blob/master/content/sample-episode-rst.rst?plain=1)

content/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = 'Sphinx-lesson'
21-
copyright = '2020, CodeRefinery'
21+
copyright = '2020-2024, CodeRefinery'
2222
author = 'CodeRefinery'
2323

2424
# roundabout way to get version. "import sphinx_lesson" would be easier, but
@@ -47,6 +47,9 @@
4747
'sphinx_rtd_theme_ext_color_contrast',
4848
]
4949

50+
# Sphinx-lesson config:
51+
sphinx_lesson_transform_html_img = False
52+
5053
# Settings for myst_nb:
5154
# https://myst-nb.readthedocs.io/en/latest/computation/execute.html#notebook-execution-modes
5255
#nb_execution_mode = "off"

content/contributing-to-a-lesson.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ is fairly easy:
99
- (optional) Set up the Python environment and preview
1010
- Send your contribution
1111

12-
In summary, each lesson is a Python project, with content in the
13-
`content/` directory. It uses the Sphinx documentation system,
14-
which is a popular, extendable tool. We have only minor extensions to
15-
make it suitable to lessons.
12+
In summary, each lesson is like a Python project, with the lesson
13+
content as its documentation in the `content/` directory (and no
14+
Python code). Everything is fairly standard: it uses the Sphinx
15+
documentation system, which is a popular, extendable tool. We have
16+
only minor extensions to make it suitable to lessons.
1617

1718
Instead of going through this process, you can also open an issue
1819
instead with your proposed change, and let someone else add it.
@@ -35,7 +36,7 @@ $ git clone git://github.com/ORGANIZATION/LESSON.git
3536
## Edit the material
3637

3738
The material is in the `content/` directory. Depending on the
38-
lesson, in may be in ReStructured Text, MyST Markdown, or Jupyter
39+
lesson, in may be in MyST Markdown, ReStructured Text, or Jupyter
3940
notebooks.
4041

4142
### ReStructured Text and MyST Markdown
@@ -47,10 +48,10 @@ this is not unstructured Markdown, but there are particular
4748
text. (In fact, "markdown" is a broad concept and everyone uses some
4849
different extensions of it).
4950

51+
- {doc}`sphinx-lesson directives for markup <directives>`
5052
- {doc}`md-and-rst`
51-
- {ref}`ReStructured Text reference <sphinx:rst-primer>`
5253
- [MyST reference](https://myst-parser.readthedocs.io/en/latest/using/syntax.html)
53-
- {doc}`sphinx-lesson directives for markup <directives>`
54+
- {ref}`ReStructured Text reference <sphinx:rst-primer>`
5455

5556
*Do not worry about getting syntax right*. Send your improvement, and
5657
editing is easy and you will learn something.

content/convert-old-lessons.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Converting an old lesson
22

3+
**This was the old CodeRefinery procedure. It is now unmaintained
4+
but might be useful for someone. Let us know if you need it revived.**
5+
36
% highlight: console
47

58
## Convert a Jekyll lesson

content/executing-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ kernelspec:
88
---
99

1010

11-
# Try executing code cells in markdown
11+
# Executing code cells in MyST markdown
1212

1313
This is a `.md` file that has a special header and a `{code-cell}`
1414
directive, that lets it

content/exercise-list.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,52 @@ instructors and helpers, and more.
77

88
## Usage
99

10-
ReST:
11-
12-
```
13-
.. exerciselist::
14-
```
15-
1610
MyST:
1711

1812
````
1913
```{exerciselist}```
2014
````
2115

16+
ReST:
17+
18+
```
19+
.. exerciselist::
20+
```
21+
2222
One can give the optional directive arguments to specify lists of
2323
admonition classes to include (default: `exercise`, `solution`,
2424
`exerciselist-include`) or exclude (default:
2525
`exerciselist-exclude`) if you want to (any {doc}`directives
2626
<directives>` which match any `include`, and do not match any
2727
`exclude` are included). Specify the options this way (ReST):
2828

29+
MyST:
30+
31+
````md
32+
```{exerciselist}
33+
:include: exercise solution instructor-note
34+
:exclude: exclude-this
2935
```
36+
37+
:::{exercise} Exercise title
38+
:class: exclude-this
39+
40+
Exercise content
41+
:::
42+
````
43+
44+
45+
ReST:
46+
47+
```rst
3048
.. exerciselist::
3149
:include: exercise solution instructor-note
3250
:exclude: exclude-this
3351
34-
.. exercise::
52+
.. exercise:: Exercise title
3553
:class: exclude-this
54+
55+
Exercise content
3656
```
3757

3858
This feature is new as of early 2022, there may be possible problems
@@ -74,8 +94,9 @@ source for hint on fixing).
7494
(advanced) Also create packaging using pyproject.toml and compare (20 min)
7595
```
7696

77-
- Consider giving your exercises permanent identifiers. They are not
78-
auto-numbered yet for a reason (what happens when more exercises are
97+
- Consider giving your exercises permanent identifiers. They are
98+
intentionally not
99+
auto-numbered yet (what happens when more exercises are
79100
added/removed?), but if you give them an ID, they will be findable
80101
even later. Suggestion is `Episodetopic-N`:
81102

@@ -103,10 +124,13 @@ source for hint on fixing).
103124

104125
## Example
105126

106-
This section contains the exercise list of sphinx-lesson. Note that
107-
the directives occur many times in random contexts, so many of them
108-
don't really make sense. Keep in mind how to ensure that your cases
109-
are better.
127+
**This section contains the exercise list of sphinx-lesson. Since
128+
sphinx-lesson has many examples of exercises, the list below is
129+
confusing and doesn't make a lot of sense. You can see a better
130+
example at [git-intro's exercise
131+
list](https://coderefinery.github.io/git-intro/exercises/).**
132+
133+
**Example begins:**
110134

111135
:::{exerciselist}
112136
:::

content/getting-started.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ the lesson develops - you might want to check back for them, later.
1111

1212
## Convert an existing jekyll lesson
1313

14-
See {doc}`convert-old-lessons`.
14+
See {doc}`convert-old-lessons`. This hasn't been used in years so may
15+
be out of date.
1516

1617
## From scratch
1718

content/gh-action.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deployment with Github Actions
22

3-
In this repository, there is a `.github/workflows/sphinx.yml` file
3+
In sphinx-lesson-template (and this lesson...), there is a `.github/workflows/sphinx.yml` file
44
that contains a Github Action that:
55

66
- Installs dependencies
@@ -9,11 +9,20 @@ that contains a Github Action that:
99

1010
- Deploys it
1111

12-
- If branch = `master` (to be renamed to `main`), deploy to github pages normally
12+
- If branch = `main`, deploy to github pages normally
1313
- For other branches, deploy to github-pages but put the result in
1414
the `branch/{branch-name}` subdirectory. If the branch name has
1515
a `/` in it, replace it with `--`.
1616
- Keep all previous deployments, but remove branch subdirectories
1717
for branches that no longer exist.
1818

1919
This allows you to view builds from pull requests or other branches.
20+
21+
## Usage
22+
23+
It is recommended to copy from
24+
[sphinx-lesson-template](https://github.com/coderefinery/sphinx-lesson-template/),
25+
since that is the primary copy that is updated with all of the latest developments.
26+
27+
Direct link:
28+
<https://github.com/coderefinery/sphinx-lesson-template/blob/main/.github/workflows/sphinx.yml>

0 commit comments

Comments
 (0)