Skip to content

Commit 5e08bb3

Browse files
fix: include H2O, O2, and O3 in list of automatically subscripted chemicals (#54)
Fixes #53
1 parent 9d6b63b commit 5e08bb3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

examples/sample-docs/projects/sample-guide/content/appendix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ The following chemical formulas should be subscripted automatically:
88
* CO2
99
* CF4
1010
* CH4
11+
* H2O
1112
* N2O
1213
* NF3
14+
* O2
15+
* O3
1316
* SF6

packages/docs-builder/src/gen-html.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,11 @@ const subscriptMap = new Map([
551551
['CO2', 'CO<sub>2</sub>'],
552552
['CF4', 'CF<sub>4</sub>'],
553553
['CH4', 'CH<sub>4</sub>'],
554+
['H2O', 'H<sub>2</sub>O'],
554555
['N2O', 'N<sub>2</sub>O'],
555556
['NF3', 'NF<sub>3</sub>'],
557+
['O2', 'O<sub>2</sub>'],
558+
['O3', 'O<sub>3</sub>'],
556559
['SF6', 'SF<sub>6</sub>']
557560
])
558561

@@ -563,8 +566,11 @@ const subscriptMap = new Map([
563566
* CO2
564567
* CF4
565568
* CH4
569+
* H2O
566570
* N2O
567571
* NF3
572+
* O2
573+
* O3
568574
* SF6
569575
*
570576
* @param s The input string.
@@ -574,7 +580,7 @@ function subscriptify(s: string): string {
574580
// XXX: Some historical graph images in the En-ROADS User Guide have
575581
// {CO2,CH4,N2O} in the file name, so this regex is set up to avoid
576582
// converting those filenames
577-
return s.replace(/(Hist_)?(CO2|CF4|CH4|N2O|NF3|SF6)/g, (m, m1, m2) => {
583+
return s.replace(/(Hist_)?(CO2|CF4|CH4|H2O|N2O|NF3|O2|O3|SF6)/g, (m, m1, m2) => {
578584
if (m1) {
579585
return m
580586
} else {

0 commit comments

Comments
 (0)