Exhibiting code on Infusion https://heydon.github.io/inclusive-pattern-library/patterns/code/ Recent content in Exhibiting code on Infusion Hugo -- gohugo.io en-us Code blocks https://heydon.github.io/inclusive-pattern-library/patterns/code/code-blocks/ Mon, 01 Jan 0001 00:00:00 +0000 https://heydon.github.io/inclusive-pattern-library/patterns/code/code-blocks/ Markdown already supports code samples both inline (using single backticks like `some code here`) and in blocks. Infusion will syntax highlight HTML, CSS, and JavaScript if you provide the correct language in the formulation of the block. So, this… ```html <button aria-pressed="false"toggle me</button ``` … will result in this: <button aria-pressed="false">toggle me</button> Note that the syntax highlighting uses a greyscale theme. Infusion is careful not to use color as part of its own design, because these colors may clash with those of the design being illustrated and discussed. CodePen embedding https://heydon.github.io/inclusive-pattern-library/patterns/code/codepen-embedding/ Mon, 01 Jan 0001 00:00:00 +0000 https://heydon.github.io/inclusive-pattern-library/patterns/code/codepen-embedding/ Sometimes just pictures of the pattern you’re documenting aren’t enough. Interactive patterns benefit from live demos, so that readers can test their functionality. Infusion offers a couple of ways to do this. The first is by embedding CodePen demos into the content. The codePen shortcode takes just one argument: the codePen’s ID. {{% codePen VpVNKW %}} This will embed the identified codePen into the content wherever you placed the shortcode, with the result view showing by default: Writing inline demos https://heydon.github.io/inclusive-pattern-library/patterns/code/writing-inline-demos/ Mon, 01 Jan 0001 00:00:00 +0000 https://heydon.github.io/inclusive-pattern-library/patterns/code/writing-inline-demos/ There are some issues with CodePen embedding , like them not working offline. They also come with CodePen branding, which will clash with the pattern you’re trying to illustrate. Infusion offers another option: a special demo shortcode that allows you to write HTML, CSS, and JavaScript directly into the markdown file. The outputted demo is encapsulated using Shadow DOM, so you don’t have to worry about broken styles and global JS.