diff --git a/examples/sample-docs/projects/sample-guide/content/appendix.md b/examples/sample-docs/projects/sample-guide/content/appendix.md index 29b5efc..bd1f187 100644 --- a/examples/sample-docs/projects/sample-guide/content/appendix.md +++ b/examples/sample-docs/projects/sample-guide/content/appendix.md @@ -3,3 +3,11 @@ This is the appendix. The text is pink because of a project- and page-specific CSS override. (This is an example of a page that is only in English and not made available for translation.) + +The following chemical formulas should be subscripted automatically: +* CO2 +* CF4 +* CH4 +* N2O +* NF3 +* SF6 diff --git a/packages/docs-builder/src/gen-html.ts b/packages/docs-builder/src/gen-html.ts index 2ec9ea8..d5d5a39 100644 --- a/packages/docs-builder/src/gen-html.ts +++ b/packages/docs-builder/src/gen-html.ts @@ -547,6 +547,7 @@ export function writeErrorHtmlFile(context: Context, mdRelPath: string, error: E const subscriptMap = new Map([ ['CO2', 'CO2'], + ['CF4', 'CF4'], ['CH4', 'CH4'], ['N2O', 'N2O'], ['NF3', 'NF3'], @@ -556,8 +557,9 @@ const subscriptMap = new Map([ /** * Replace non-subscript forms of common chemicals with their subscripted equivalent. * For example, "CO2" will be converted to "CO2". This only handles - * the following common forms: + * the following common forms (defined in the map above): * CO2 + * CF4 * CH4 * N2O * NF3 @@ -570,7 +572,7 @@ function subscriptify(s: string): string { // XXX: Some historical graph images in the En-ROADS User Guide have // {CO2,CH4,N2O} in the file name, so this regex is set up to avoid // converting those filenames - return s.replace(/(Hist_)?(CO2|CH4|N2O|NF3|SF6)/g, (m, m1, m2) => { + return s.replace(/(Hist_)?(CO2|CF4|CH4|N2O|NF3|SF6)/g, (m, m1, m2) => { if (m1) { return m } else {