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