Files
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

19 lines
408 B
JavaScript

'use strict'
module.exports = code
var detab = require('detab')
var u = require('unist-builder')
function code(h, node) {
var value = node.value ? detab(node.value + '\n') : ''
var lang = node.lang && node.lang.match(/^[^ \t]+(?=[ \t]|$)/)
var props = {}
if (lang) {
props.className = ['language-' + lang]
}
return h(node.position, 'pre', [h(node, 'code', props, [u('text', value)])])
}