Skip to content

Commit

Permalink
fix: add plaintext language
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert committed May 22, 2024
1 parent 6548c38 commit 3e03abe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/frontend/src/frontend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// @ts-ignore
import gleamHljs from '@gleam-lang/highlight.js-gleam'
import hljs from 'highlight.js/lib/core'
import plaintext from 'highlight.js/lib/languages/plaintext'
// @ts-ignore
import { main } from './frontend.gleam'

hljs.registerLanguage('gleam', gleamHljs)
hljs.registerLanguage('plaintext', plaintext)
document.addEventListener('DOMContentLoaded', main)
2 changes: 1 addition & 1 deletion apps/frontend/src/markdown.ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { markedHighlight } from 'marked-highlight'
const parser = new Marked(
markedHighlight({
langPrefix: 'hljs language-',
highlight(code, lang, info) {
highlight(code, lang, _info) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext'
return hljs.highlight(code, { language }).value
},
Expand Down

0 comments on commit 3e03abe

Please sign in to comment.