Skip to content

Commit 95fb314

Browse files
committed
markdown source builds
Auto-generated via `{sandpaper}` Source : 806faa9 Branch : main Author : Robert Davey <robertdavey@carpentries.org> Time : 2025-08-08 12:52:11 +0000 Message : Merge pull request #243 from carpentries/frog-glosario-docs-1 Update docs with glosario usage
1 parent d765c90 commit 95fb314

6 files changed

Lines changed: 1191 additions & 4 deletions

File tree

config.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#------------------------------------------------------------
2+
# Values for this lesson.
3+
#------------------------------------------------------------
4+
5+
# Which carpentry is this (swc, dc, lc, or cp)?
6+
# swc: Software Carpentry
7+
# dc: Data Carpentry
8+
# lc: Library Carpentry
9+
# cp: Carpentries (to use for instructor traning for instance)
10+
carpentry: 'cp'
11+
12+
# Overall title for pages.
13+
title: 'Introduction to The Carpentries Workbench'
14+
15+
# Date the lesson was created (this is empty by default)
16+
created: ~
17+
18+
# Comma-separated list of keywords for the lesson
19+
keywords: 'static site, lesson template, markdown, R, software'
20+
21+
# Life cycle stage of the lesson
22+
# possible values: pre-alpha, alpha, beta, stable
23+
life_cycle: 'beta'
24+
25+
# License of the lesson
26+
license: 'CC-BY 4.0'
27+
28+
# Link to the source repository for this lesson
29+
source: 'https://github.com/carpentries/sandpaper-docs/'
30+
31+
# Default branch of your lesson
32+
branch: 'main'
33+
34+
# Who to contact if there are any issues
35+
contact: 'tobyhodges@carpentries.org'
36+
37+
# Navigation ------------------------------------------------
38+
#
39+
# Use the following menu items to specify the order of
40+
# individual pages in each dropdown section. Leave blank to
41+
# include all pages in the folder.
42+
#
43+
# Example -------------
44+
#
45+
# episodes:
46+
# - introduction.md
47+
# - first-steps.md
48+
#
49+
# learners:
50+
# - setup.md
51+
#
52+
# instructors:
53+
# - instructor-notes.md
54+
#
55+
# profiles:
56+
# - one-learner.md
57+
# - another-learner.md
58+
59+
# Order of episodes in your lesson
60+
episodes:
61+
- introduction.md
62+
- episodes.Rmd
63+
- editing.md
64+
- example.Rmd
65+
- deployment.md
66+
- update.md
67+
- pull-request.md
68+
69+
# Information for Learners
70+
learners:
71+
- reference.md
72+
- setup.md
73+
- github-pat.md
74+
- component-guide.md
75+
- migrating-from-styles.md
76+
- style.md
77+
78+
# Information for Instructors
79+
instructors:
80+
- instructor-notes.md
81+
82+
# Learner Profiles
83+
profiles:
84+
- maintainer.md
85+
- instructor.md
86+
87+
# Customisation ---------------------------------------------
88+
#
89+
# This space below is where custom yaml items (e.g. pinning
90+
# sandpaper and varnish versions) should live
91+
92+

episodes.md

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exercises: 2
1414
- What syntax do you use to write links?
1515
- How do you include images?
1616
- How do you include math?
17+
- How do you include Glosario terms?
1718

1819
::::::::::::::::::::::::::::::::::::::::::::::::
1920

@@ -1082,13 +1083,110 @@ pie(
10821083

10831084
## Math
10841085

1085-
One of our episodes contains $\LaTeX$ equations when describing how to create
1086-
dynamic reports with {knitr}, so we now use mathjax to describe this:
1086+
One of our episodes contains $\LaTeX$ equations when describing how to create dynamic reports with {knitr}, so we now use mathjax to describe this:
10871087

10881088
`$\alpha = \dfrac{1}{(1 - \beta)^2}$` becomes: $\alpha = \dfrac{1}{(1 - \beta)^2}$
10891089

10901090
Cool, right?
10911091

1092+
1093+
## Glosario Terms
1094+
1095+
[Glosario](https://glosario.carpentries.org) is the Carpentries data science glossary that is developed by the international community, providing terms, definitions and translations to make lessons more accessible.
1096+
1097+
{sandpaper} can automatically generate glossary links in lessons from links to Glosario terms in lesson content markdown.
1098+
1099+
### Configuration
1100+
1101+
Firstly, to enable this behaviour, the `glosario` key needs to be added to a lesson's `config.yaml`.
1102+
1103+
For automatic retrieval of the latest `glossary.yml` from Glosario's GitHub repository, set:
1104+
1105+
```yaml
1106+
glosario: true
1107+
```
1108+
1109+
For manual retrieval from a local (e.g. working on your lesson offline) or remote location (e.g. providing a specific Glosario version), supply a string relative/absolute path or URL to the config:
1110+
1111+
```yaml
1112+
# load a glossary from a local file using an absolute path
1113+
glosario: "/path/to/your/glossary.yml"
1114+
1115+
# load a glossary from a local file using path relative to the lesson
1116+
glosario: "../glossary.yml"
1117+
1118+
# load a glossary from a remote location
1119+
glosario: "https://foo.com/glossary.yml"
1120+
```
1121+
1122+
### Lesson content
1123+
1124+
A lesson maintainer/contributor can add placeholders into the main content of lessons that sandpaper will subsequently process.
1125+
1126+
Sandpaper understands links to Glosario terms in two ways, either a template-style term, or a hard link to the term page, i.e.:
1127+
1128+
- `{{ glosario.<term> }}`
1129+
- `[<term>](https://glosario.carpentries.org/en/#<term>)`
1130+
1131+
:::::::::::::: callout
1132+
1133+
## Automatic language selection
1134+
1135+
When using the template-style term, sandpaper will automatically generate the URL link using the language specified in the `config.yaml` `lang` setting.
1136+
1137+
When using the markdown link style, sandpaper will automatically replace the `en/` in the link with the language specified in the `config.yaml` `lang` setting.
1138+
1139+
For example, if the `config.yaml` language is set to `lang: de`:
1140+
1141+
`[data_structure](https://glosario.carpentries.org/en/#data_structure)`
1142+
1143+
will be replaced with:
1144+
1145+
`[data_structure](https://glosario.carpentries.org/de/#data_structure)`
1146+
1147+
If the term is not available in that language, a warning will be printed when the lesson builds, and it will default back to English.
1148+
1149+
::::::::::::::::::::::
1150+
1151+
### Example output
1152+
1153+
To look at a specific example, the [datacarpentry/spreadsheet-ecology-lesson](https://github.com/datacarpentry/spreadsheet-ecology-lesson/blob/main/episodes/01-format-data.md) can be edited to include Glosario links.
1154+
1155+
To add a glosario link to the term `data structure` at the URL `https://glosario.carpentries.org/en/#data_structure`, the markdown becomes:
1156+
1157+
```
1158+
The most common mistake made is treating spreadsheet programs like lab notebooks, that is, relying on context,
1159+
notes in the margin, spatial layout of data and fields to convey information. As humans, we can (usually) interpret
1160+
these things, but computers don't view information the same way, and unless we explain to the computer what
1161+
every single thing means (and that can be hard!), it will not be able to see how our data fits together. This is called
1162+
the data structure {{ glosario.data_structure }}.
1163+
```
1164+
1165+
Similarly, to add a link using the inline markdown link syntax, the markdown becomes:
1166+
1167+
```
1168+
Using the power of computers, we can manage and analyze data in much more effective and faster ways, but to
1169+
use that power, we have to set up our data for the computer to be able to understand it
1170+
(and computers are very [literal](https://glosario.carpentries.org/en/#literal)).
1171+
```
1172+
1173+
Once the lesson is built, this will produce the following output:
1174+
1175+
![Example of superscript and inline Glosario link generation](fig/glosario-link-example.png){alt='Screenshot of a lesson with a Glosario link as a superscript and an inline link.'}
1176+
1177+
In the first example, `{{ glosario.data_structure }}` adds a `data_structure` link as a superscript inline.
1178+
1179+
In the second example, a typical markdown link will be inserted.
1180+
1181+
In either case, sandpaper will find these links and add them to the global `reference.md` page in your lesson, built as `reference.html`, and linked in the top lesson menu as `Glossary`:
1182+
1183+
![Example of automatic inclusion of Glosario links in the Glossary page](fig/glosario-glossary-page.png){alt='Screenshot of a lesson with Glosario links in the Glossary reference page.'}
1184+
1185+
### Unavailable terms
1186+
1187+
Users will receive a warning when using terms that are not in the currently selected config.yaml language for the lesson:
1188+
1189+
10921190
:::::::::::::::: keypoints :::::::::::::::::::::
10931191
10941192
- Use `.Rmd` files for lessons even if you don't need to generate any code
@@ -1104,4 +1202,3 @@ Cool, right?
11041202
current working proposal is to call these "chapters".
11051203
[^worry]: Do not worry if you aren't comfortable yet, that's what we will show
11061204
you in this episode!
1107-

fig/glosario-glossary-page.png

62.6 KB
Loading

fig/glosario-link-example.png

54 KB
Loading

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"index.md" "4d117199b579f6901292749f1a414a00" "site/built/index.md" "2025-08-08"
66
"links.md" "a7ea11385a9d821b8f57edb0951c83ca" "site/built/links.md" "2025-08-08"
77
"episodes/introduction.md" "b1ca0d51bfee1538beabc08f46b389cf" "site/built/introduction.md" "2025-08-08"
8-
"episodes/episodes.Rmd" "4f9401544dcfcd6d0ba5b61dca806f04" "site/built/episodes.md" "2025-08-08"
8+
"episodes/episodes.Rmd" "58f17a3eb4fd778714d9ed0487ed71f7" "site/built/episodes.md" "2025-08-08"
99
"episodes/editing.md" "8c96f675957e4af4f62aea13fb1d799e" "site/built/editing.md" "2025-08-08"
1010
"episodes/example.Rmd" "215e3c4ed500fef3410f040349fb0a73" "site/built/example.md" "2025-08-08"
1111
"episodes/deployment.md" "f15377cac190ef5435a60d074aa8aeb3" "site/built/deployment.md" "2025-08-08"

0 commit comments

Comments
 (0)