This commit is contained in:
Tommy Parnell
2022-03-10 22:10:11 -05:00
parent 813d8fbdb5
commit 7872234643

View File

@@ -21,10 +21,10 @@ fastify.post('/', function (request, reply) {
if(!lang) {
return reply.send(request.body)
}
const highlighted = Prism.highlight(data, Prism.languages[lang], lang)
const highlighted = Prism.highlight(data.replace(/```[a-zA-Z]*/m, '').replace('```', ''), Prism.languages[lang], lang)
// remove any backticks and the language
const highlightedCleaned = highlighted.replace(/```[a-zA-Z]*/m, '').replace('```', '').trim()
const highlightedCleaned = highlighted.trim()
return `<pre><code>${highlightedCleaned}</code></pre>`
})