Add render hook for 'chem' code blocks#1286
Merged
geriom merged 1 commit intogoogle:mainfrom Dec 5, 2022
Merged
Conversation
45247dd to
bd2c927
Compare
39339ab to
13bda31
Compare
13bda31 to
bed95f7
Compare
bed95f7 to
5303a04
Compare
Collaborator
|
This is so cool! The changes to mermaid diagrams introduced conflicts here. @deining can you take a look and fix the merge conflicts? Sorry for taking so long to review this. |
5303a04 to
bfd5222
Compare
Contributor
Author
Done. |
Auto activation of `math' and 'chem' blocks Add ability to enable KateX and/or mhchem for individual pages only Upgrade to KaTeX 0.16.3
bfd5222 to
7b8e268
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With PR #987 merged,
mathcode blocks can now be used to display mathematical formulae, Based on this work, this PR adds the feature to usechemcode blocks to display chemical formulae. With this PR merged, you can now write something like:Please note that this PR relies on render hook templates, a feature that is available as of hugo 0.93. For users with older hugo versions., the old, now deprecated way of coding a formulae on its own line is still available.
Furthermore, this PR brings in some additions that streamline and ease the use of formulae for technical writers:
When `math' or 'chem' blocks are used on a page, the required scripts are now loaded automatically. There is no need to enable KaTeX and/or ´mhchem´ in the site configuration any more (only when using hugo 0.93 or newer).
Up to now, KaTeX and/or
mhchemscripts were enabled in the sitewideconfigfile. Once enabled, scripts were loaded for all pages, even it there were no formulae present on the page. With this PR in place, activation of scripts is now possible on a per page basis, too, simply by adding attributes in the page front matter:Also, the documentation page in the user guide was adapted in order to reflect the changes introduced with this PR.