File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,30 @@ const INLINE_SYNTAXES: InlineSyntax[] = [
100100 contentIndex : 1 ,
101101 getAttrs : ( m ) => ( { content : m [ 1 ] } ) ,
102102 } ,
103+ // sub/sup 上下标
104+ {
105+ type : "sub" ,
106+ pattern : / < s u b > ( .+ ?) < \/ s u b > / g,
107+ prefix : "<sub>" ,
108+ suffix : "</sub>" ,
109+ contentIndex : 1 ,
110+ } ,
111+ {
112+ type : "sup" ,
113+ pattern : / < s u p > ( .+ ?) < \/ s u p > / g,
114+ prefix : "<sup>" ,
115+ suffix : "</sup>" ,
116+ contentIndex : 1 ,
117+ } ,
118+ // 通用行内 HTML 元素(排除已有专用 mark 的 sub/sup)
119+ {
120+ type : "html_inline" ,
121+ pattern : / < ( [ a - z A - Z ] [ a - z A - Z 0 - 9 ] * ) ( \s (?: [ ^ > " ' ] | " [ ^ " ] * " | ' [ ^ ' ] * ' ) * ) ? > ( .+ ?) < \/ \1> / g,
122+ prefix : ( m : RegExpExecArray ) => `<${ m [ 1 ] } ${ m [ 2 ] || "" } >` ,
123+ suffix : ( m : RegExpExecArray ) => `</${ m [ 1 ] } >` ,
124+ contentIndex : 3 ,
125+ getAttrs : ( m : RegExpExecArray ) => ( { tag : m [ 1 ] . toLowerCase ( ) , htmlAttrs : ( m [ 2 ] || "" ) . trim ( ) } ) ,
126+ } ,
103127] ;
104128
105129/** 块级语法模式 */
You can’t perform that action at this time.
0 commit comments