From c2b7a7f2ce2a49fd1840056fffb1973234b3690d Mon Sep 17 00:00:00 2001 From: Alex Fornuto Date: Wed, 3 Apr 2024 14:56:41 -0500 Subject: [PATCH] extend prism... - Expands the languages highlighted to include bash and json. - Allows us to use a comment in code blocks to prepend a character to the proceeding line, which is not included in the text copied with the code block copy button. A future PR will expand this new functionality such that example output is also not included by the code block copy button. --- docusaurus.config.js | 8 ++++++++ src/css/custom.css | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/docusaurus.config.js b/docusaurus.config.js index f87cc28..ad0e85d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -135,6 +135,14 @@ const config = { prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, + additionalLanguages: ['bash', 'json'], + magicComments: [ + // Remember to extend the default highlight class name as well! + { + className: 'code-block-terminal-command', + line: 'terminal-command', + }, + ], }, colorMode: { defaultMode: "dark", diff --git a/src/css/custom.css b/src/css/custom.css index 5509214..3762a42 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -35,4 +35,9 @@ [data-theme='dark'] footer { background-color: #000; +} + +.code-block-terminal-command:before { + content: '$'; + margin-right: 10px; } \ No newline at end of file