From 9340d69ed8f9493c78d96c2864b1e73d55ed62ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Bl=C3=A4ttermann?= Date: Tue, 13 Dec 2022 07:11:55 +0100 Subject: [PATCH] Fix syntax highlighting for Training Quickstart --- website/src/widgets/quickstart-training.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/website/src/widgets/quickstart-training.js b/website/src/widgets/quickstart-training.js index 68971d2d9..57691edd4 100644 --- a/website/src/widgets/quickstart-training.js +++ b/website/src/widgets/quickstart-training.js @@ -1,5 +1,7 @@ import React, { useState } from 'react' -import highlightCode from 'gatsby-remark-prismjs/highlight-code.js' +import Prism from 'prismjs' + +import 'prismjs/components/prism-ini.min.js' import { Quickstart } from '../components/quickstart' import generator, { DATA as GENERATOR_DATA } from './quickstart-training-generator' @@ -108,11 +110,7 @@ export default function QuickstartTraining({ id, title, download = 'base_config. }) const rawStr = content.trim().replace(/\n\n\n+/g, '\n\n') const rawContent = `${COMMENT}\n${rawStr}` - const displayContent = highlightCode('ini', rawContent) - .split('\n') - .map((line) => (line.startsWith('#') ? `${line}` : line)) - .join('\n') - + const displayContent = Prism.highlight(rawContent, Prism.languages.ini, 'ini') let data = DATA data[0].dropdown = models.languages .map(({ name, code }) => ({