fix: compatibility with marked v3

- ab0e0a1146
This commit is contained in:
Ming Di Leom 2021-10-10 09:46:49 +00:00
parent ea92a6122c
commit 160a621db7
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 2 additions and 2 deletions

View File

@ -24,14 +24,14 @@ const smartypants = (str) => {
hexo.extend.filter.register('marked:tokenizer', function(tokenizer) { hexo.extend.filter.register('marked:tokenizer', function(tokenizer) {
const { smartypants: isSmarty } = this.config.marked; const { smartypants: isSmarty } = this.config.marked;
tokenizer.inlineText = function(src, inRawBlock) { tokenizer.inlineText = function(src) {
const { rules } = this; const { rules } = this;
// https://github.com/markedjs/marked/blob/b6773fca412c339e0cedd56b63f9fa1583cfd372/src/Tokenizer.js#L643-L658 // https://github.com/markedjs/marked/blob/b6773fca412c339e0cedd56b63f9fa1583cfd372/src/Tokenizer.js#L643-L658
const cap = rules.inline.text.exec(src); const cap = rules.inline.text.exec(src);
if (cap) { if (cap) {
let text; let text;
if (inRawBlock) { if (this.lexer.state.inRawBlock) {
text = cap[0]; text = cap[0];
} else { } else {
text = escape(isSmarty ? smartypants(cap[0]) : cap[0]); text = escape(isSmarty ? smartypants(cap[0]) : cap[0]);