wegwe
This commit is contained in:
@@ -66,6 +66,7 @@ let maxWidths = null;
|
|||||||
marked.setOptions({
|
marked.setOptions({
|
||||||
breaks: true, // 是否回车换行
|
breaks: true, // 是否回车换行
|
||||||
gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范
|
gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范
|
||||||
|
// pedantic: true, //严格模式
|
||||||
// highlight(code:any, lang:any) {
|
// highlight(code:any, lang:any) {
|
||||||
// // 语法高亮
|
// // 语法高亮
|
||||||
// let val = code;
|
// let val = code;
|
||||||
@@ -84,6 +85,9 @@ marked.setOptions({
|
|||||||
const renderer = new marked.Renderer();
|
const renderer = new marked.Renderer();
|
||||||
// const originRenderer = _.cloneDeep(renderer);
|
// const originRenderer = _.cloneDeep(renderer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 图片调整300px
|
// 图片调整300px
|
||||||
renderer.image = function (href, title, text) {
|
renderer.image = function (href, title, text) {
|
||||||
// console.log("href, title, text", href, title, text);
|
// console.log("href, title, text", href, title, text);
|
||||||
@@ -161,11 +165,21 @@ renderer.text = function (text) {
|
|||||||
|
|
||||||
// 分隔符
|
// 分隔符
|
||||||
renderer.hr = function () {
|
renderer.hr = function () {
|
||||||
console.log('hr')
|
|
||||||
// return '<hr>\n';
|
// return '<hr>\n';
|
||||||
return '➖➖➖➖➖';
|
return '➖➖➖➖➖<br/>';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 自定义分隔线解析规则
|
||||||
|
// marked.Lexer.rules.block.gfm.hr = /^(\*{3,}|-{3,}|_{3,})(?:\s*)$/;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 内联样式,使用直角引号「」
|
// 内联样式,使用直角引号「」
|
||||||
renderer.codespan = function (text) {
|
renderer.codespan = function (text) {
|
||||||
// return `「${text}」`;
|
// return `「${text}」`;
|
||||||
@@ -247,8 +261,9 @@ renderer.html= function(html, block) {
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自定义分隔线解析规则
|
|
||||||
// marked.Lexer.rules.block.gfm.hr = /^(\*{3,}|-{3,}|_{3,})(?:\s*)$/;
|
|
||||||
|
|
||||||
// 使用拓展
|
// 使用拓展
|
||||||
marked.use({ renderer });
|
marked.use({ renderer });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user