mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 10:49:31 +08:00
22 lines
490 B
Text
22 lines
490 B
Text
/**
|
|
* @typedef {import('../types.js').Context} Context
|
|
* @typedef {import('../types.js').Options} Options
|
|
*/
|
|
|
|
/**
|
|
* @param {Context} context
|
|
* @returns {Exclude<Options['fence'], undefined>}
|
|
*/
|
|
export function checkFence(context) {
|
|
const marker = context.options.fence || '`'
|
|
|
|
if (marker !== '`' && marker !== '~') {
|
|
throw new Error(
|
|
'Cannot serialize code with `' +
|
|
marker +
|
|
'` for `options.fence`, expected `` ` `` or `~`'
|
|
)
|
|
}
|
|
|
|
return marker
|
|
}
|