@@ -33,7 +33,8 @@ function mangleEmail(text) {
3333
3434const renderer = {
3535 // Add id attribute to headings
36- heading ( text , level ) {
36+ heading ( { tokens, depth : level } ) {
37+ let text = this . parser . parseInline ( tokens ) ;
3738 const { anchorAlias, headerIds, modifyAnchors, _headingId } = this . options ;
3839
3940 if ( ! headerIds ) {
@@ -67,7 +68,8 @@ const renderer = {
6768 return `<h${ level } id="${ id } "><a href="#${ id } " class="headerlink" title="${ stripHTML ( text ) } "></a>${ text } </h${ level } >` ;
6869 } ,
6970
70- link ( href , title , text ) {
71+ link ( { tokens, href, title } ) {
72+ const text = this . parser . parseInline ( tokens ) ;
7173 const { external_link, sanitizeUrl, hexo, mangle } = this . options ;
7274 const { url : urlCfg } = hexo . config ;
7375
@@ -96,7 +98,7 @@ const renderer = {
9698 out += '"' ;
9799
98100 if ( title ) {
99- out += ` title="${ title } "` ;
101+ out += ` title="${ escape ( title ) } "` ;
100102 }
101103 if ( external_link ) {
102104 const target = ' target="_blank"' ;
@@ -118,7 +120,8 @@ const renderer = {
118120 } ,
119121
120122 // Support Basic Description Lists
121- paragraph ( text ) {
123+ paragraph ( { tokens } ) {
124+ const text = this . parser . parseInline ( tokens ) ;
122125 const { descriptionLists = true } = this . options ;
123126
124127 if ( descriptionLists ) {
@@ -131,7 +134,7 @@ const renderer = {
131134 } ,
132135
133136 // Prepend root to image path
134- image ( href , title , text ) {
137+ image ( { href, title, text } ) {
135138 const { options } = this ;
136139 const { hexo } = options ;
137140 const { relative_link } = hexo . config ;
@@ -149,8 +152,8 @@ const renderer = {
149152 }
150153
151154 let out = `<img src="${ encodeURL ( href ) } "` ;
152- if ( text ) out += ` alt="${ text } "` ;
153- if ( title ) out += ` title="${ title } "` ;
155+ if ( text ) out += ` alt="${ escape ( text ) } "` ;
156+ if ( title ) out += ` title="${ escape ( title ) } "` ;
154157 if ( lazyload ) out += ' loading="lazy"' ;
155158
156159 out += '>' ;
@@ -185,7 +188,7 @@ const smartypants = (str, quotes) => {
185188} ;
186189
187190const tokenizer = {
188- // Support AutoLink option
191+ // Support autolink option
189192 url ( src ) {
190193 const { autolink } = this . options ;
191194
@@ -225,7 +228,7 @@ module.exports = function(data, options) {
225228 // exec filter to extend marked
226229 this . execFilterSync ( 'marked:use' , marked . use , { context : this } ) ;
227230
228- // exec filter to extend renderer.
231+ // exec filter to extend renderer
229232 this . execFilterSync ( 'marked:renderer' , renderer , { context : this } ) ;
230233
231234 // exec filter to extend tokenizer
0 commit comments