Fix syntax highlighting for Training Quickstart

This commit is contained in:
Marcus Blättermann 2022-12-13 07:11:55 +01:00
parent 04ec2c0e93
commit 9340d69ed8
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D

View File

@ -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('#') ? `<span class="token comment">${line}</span>` : line))
.join('\n')
const displayContent = Prism.highlight(rawContent, Prism.languages.ini, 'ini')
let data = DATA
data[0].dropdown = models.languages
.map(({ name, code }) => ({