hexo 博客中括号无法正确显示
brackets cannot be displayed correctly in hexo blog
我尝试使用Github页面和hexo建立个人博客。我正在使用材料主题。但是代码区的括号在hexo blog中无法正确显示。相反,它显示为 {.我不确定我做了什么改变。
代码现在看起来像这样。
public class Client {
public static void main() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.writeInt(1);
我对前端的事情很陌生,也不知道自己改了什么。我曾经怀疑我的 /node_modules/marked/lib/marked.js 有问题。但是,我去 https://github.com/markedjs/marked/tree/master/lib 下载了一个新的。它仍然不起作用。有人可以帮我吗?
marked.js
中的内联部分
var inline = {
escape: /^\([!"#$%&'()*+,\-./:;<=>?@\[\]\^_`{|}~])/,
// escape: /^\([`*\[\]()#$+\-.!_>])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noopTest,
tag: '^comment' + '|^</[a-zA-Z][\w:-]*\s*>' // self-closing tag
+ '|^<[a-zA-Z][\w-]*(?:attribute)*?\s*/?>' // open tag
+ '|^<\?[\s\S]*?\?>' // processing instruction, e.g. <?php ?>
+ '|^<![a-zA-Z]+\s[\s\S]*?>' // declaration, e.g. <!DOCTYPE html>
+ '|^<!\[CDATA\[[\s\S]*?\]\]>',
// CDATA section
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\[\[\]]?|[^\[\]\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\[\[\]]|[^\[\]])*)\](?:\[\])?/,
reflinkSearch: 'reflink|nolink(?!\()',
strong: {
start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,
// (1) returns if starts w/ punctuation
middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)*?_)+?)__$/,
endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
em: {
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
// (1) returns if starts w/ punctuation
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)*?_)+?_$/,
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
code: /^(`+)([^`]|[^`][\s\S]*?[^`])(?!`)/,
br: /^( {2,}|\)\n(?!\s*$)/,
del: noopTest,
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,
punctuation: /^([\s*punctuation])/
}; // list of punctuation marks from common mark spec
// without * and _ to workaround cases with double emphasis
https://github.com/hexojs/hexo/issues/4501
// node_modules/hexo_prism_plugin/src/index.js
// L8-L14
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"'
};
解决方法是,
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'{': '{',
'}': '}'
};
我尝试使用Github页面和hexo建立个人博客。我正在使用材料主题。但是代码区的括号在hexo blog中无法正确显示。相反,它显示为 {.我不确定我做了什么改变。 代码现在看起来像这样。
public class Client {
public static void main() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.writeInt(1);
我对前端的事情很陌生,也不知道自己改了什么。我曾经怀疑我的 /node_modules/marked/lib/marked.js 有问题。但是,我去 https://github.com/markedjs/marked/tree/master/lib 下载了一个新的。它仍然不起作用。有人可以帮我吗?
marked.js
中的内联部分 var inline = {
escape: /^\([!"#$%&'()*+,\-./:;<=>?@\[\]\^_`{|}~])/,
// escape: /^\([`*\[\]()#$+\-.!_>])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noopTest,
tag: '^comment' + '|^</[a-zA-Z][\w:-]*\s*>' // self-closing tag
+ '|^<[a-zA-Z][\w-]*(?:attribute)*?\s*/?>' // open tag
+ '|^<\?[\s\S]*?\?>' // processing instruction, e.g. <?php ?>
+ '|^<![a-zA-Z]+\s[\s\S]*?>' // declaration, e.g. <!DOCTYPE html>
+ '|^<!\[CDATA\[[\s\S]*?\]\]>',
// CDATA section
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\[\[\]]?|[^\[\]\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\[\[\]]|[^\[\]])*)\](?:\[\])?/,
reflinkSearch: 'reflink|nolink(?!\()',
strong: {
start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,
// (1) returns if starts w/ punctuation
middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)*?_)+?)__$/,
endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
em: {
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
// (1) returns if starts w/ punctuation
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\_)|overlapSkip)*?_)+?_$/,
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
code: /^(`+)([^`]|[^`][\s\S]*?[^`])(?!`)/,
br: /^( {2,}|\)\n(?!\s*$)/,
del: noopTest,
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,
punctuation: /^([\s*punctuation])/
}; // list of punctuation marks from common mark spec
// without * and _ to workaround cases with double emphasis
https://github.com/hexojs/hexo/issues/4501
// node_modules/hexo_prism_plugin/src/index.js
// L8-L14
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"'
};
解决方法是,
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'{': '{',
'}': '}'
};