mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 01:34:30 +03:00
Fix syntax highlighting for Training Quickstart
This commit is contained in:
parent
04ec2c0e93
commit
9340d69ed8
|
@ -1,5 +1,7 @@
|
||||||
import React, { useState } from 'react'
|
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 { Quickstart } from '../components/quickstart'
|
||||||
import generator, { DATA as GENERATOR_DATA } from './quickstart-training-generator'
|
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 rawStr = content.trim().replace(/\n\n\n+/g, '\n\n')
|
||||||
const rawContent = `${COMMENT}\n${rawStr}`
|
const rawContent = `${COMMENT}\n${rawStr}`
|
||||||
const displayContent = highlightCode('ini', rawContent)
|
const displayContent = Prism.highlight(rawContent, Prism.languages.ini, 'ini')
|
||||||
.split('\n')
|
|
||||||
.map((line) => (line.startsWith('#') ? `<span class="token comment">${line}</span>` : line))
|
|
||||||
.join('\n')
|
|
||||||
|
|
||||||
let data = DATA
|
let data = DATA
|
||||||
data[0].dropdown = models.languages
|
data[0].dropdown = models.languages
|
||||||
.map(({ name, code }) => ({
|
.map(({ name, code }) => ({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user