diff --git a/package.json b/package.json index 946d798..6a936a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-md", - "version": "1.3.5", + "version": "1.3.6", "private": true, "homepage": "https://doocs.gitee.io/md", "scripts": { diff --git a/src/assets/scripts/renderers/wx-renderer.js b/src/assets/scripts/renderers/wx-renderer.js index 48edc29..4c2b166 100644 --- a/src/assets/scripts/renderers/wx-renderer.js +++ b/src/assets/scripts/renderers/wx-renderer.js @@ -123,30 +123,19 @@ const WxRenderer = function (opts) { text = text.replace(/
`) return `
${text}` } - renderer.code = (text, infoString) => { - text = text.replace(//g, '>') - - let lines = text.split('\n') - let codeLines = [] - let numbers = [] - - for (let i = 0; i < lines.length; i++) { - const line = lines[i] - codeLines.push(`
${(line || '
')}
`)
- numbers.push('')
- }
- const lang = infoString || '';
- const codeTheme = 'github';
+ renderer.code = (text, lang) => {
+ text = text.replace(//g, '>')
+ const codeLines = text.split('\n').map(line => `${(line || '
')}
`)
+ const codeTheme = 'github'
return `
${codeLines.join('')}
${text}
`
+ renderer.codespan = (text, lang) => `${text}
`
renderer.listitem = text => `<%s/>${text}`
renderer.list = (text, ordered, start) => {
@@ -174,16 +163,12 @@ const WxRenderer = function (opts) {
renderer.link = (href, title, text) => {
if (href.indexOf('https://mp.weixin.qq.com') === 0) {
return `${text}`
- } else if (href === text) {
- return text
- } else {
- if (status) {
- let ref = addFootnote(title || text, href)
- return `${text}[${ref}]`
- } else {
- return text
- }
}
+ if (href === text || !status) {
+ return text
+ }
+ let ref = addFootnote(title || text, href)
+ return `${text}[${ref}]`
}
renderer.strong = text => `${text}`
renderer.em = text => `${text}`