fix(plugin-md-power): fix potential null pointer exceptions when parsing collapse containers (#866)
This commit is contained in:
parent
ca51a345fb
commit
916e9141d9
@ -109,10 +109,10 @@ function parseCollapse(tokens: Token[], index: number, attrs: CollapseMeta): num
|
||||
idx++
|
||||
|
||||
const inlineToken = tokens[i + 2]
|
||||
const firstToken = inlineToken.children![0]
|
||||
const firstToken = inlineToken.children?.[0]
|
||||
let flag: string = ''
|
||||
let expand: boolean | undefined
|
||||
if (firstToken.type === 'text') {
|
||||
if (firstToken?.type === 'text') {
|
||||
firstToken.content = firstToken.content.trim().replace(/^:[+\-]\s*/, (match) => {
|
||||
flag = match.trim()
|
||||
return ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user