mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
build: release v1.3.6
* 微信代码块CSS样式美化调整 * JavaScript代码优化
This commit is contained in:
parent
27b8fe99b0
commit
7eb8e99be5
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-md",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.6",
|
||||
"private": true,
|
||||
"homepage": "https://doocs.gitee.io/md",
|
||||
"scripts": {
|
||||
|
@ -123,30 +123,19 @@ const WxRenderer = function (opts) {
|
||||
text = text.replace(/<p.*?>/g, `<p ${getStyles('blockquote_p')}>`)
|
||||
return `<blockquote ${getStyles('blockquote')}>${text}</blockquote>`
|
||||
}
|
||||
renderer.code = (text, infoString) => {
|
||||
text = text.replace(/</g, '<')
|
||||
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(`<code class="prettyprint"><span class="code-snippet_outer">${(line || '<br>')}</span></code>`)
|
||||
numbers.push('<li></li>')
|
||||
}
|
||||
const lang = infoString || '';
|
||||
const codeTheme = 'github';
|
||||
renderer.code = (text, lang) => {
|
||||
text = text.replace(/</g, '<').replace(/>/g, '>')
|
||||
const codeLines = text.split('\n').map(line => `<code class="prettyprint"><span class="code-snippet_outer">${(line || '<br>')}</span></code>`)
|
||||
const codeTheme = 'github'
|
||||
return `
|
||||
<section class="code-snippet__${codeTheme}">
|
||||
<pre class="code__pre" data-lang="${lang}">
|
||||
${codeLines.join('')}
|
||||
</pre>
|
||||
</section>
|
||||
`;
|
||||
`
|
||||
}
|
||||
renderer.codespan = (text, infoString) => `<code ${getStyles('codespan')}>${text}</code>`
|
||||
renderer.codespan = (text, lang) => `<code ${getStyles('codespan')}>${text}</code>`
|
||||
renderer.listitem = text => `<span ${getStyles('listitem')}><span style="margin-right: 10px;"><%s/></span>${text}</span>`
|
||||
|
||||
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 `<a href="${href}" title="${(title || text)}" ${getStyles('wx_link')}>${text}</a>`
|
||||
} else if (href === text) {
|
||||
}
|
||||
if (href === text || !status) {
|
||||
return text
|
||||
} else {
|
||||
if (status) {
|
||||
}
|
||||
let ref = addFootnote(title || text, href)
|
||||
return `<span ${getStyles('link')}>${text}<sup>[${ref}]</sup></span>`
|
||||
} else {
|
||||
return text
|
||||
}
|
||||
}
|
||||
}
|
||||
renderer.strong = text => `<strong ${getStyles('strong')}>${text}</strong>`
|
||||
renderer.em = text => `<span style="font-style: italic;">${text}</span>`
|
||||
|
Loading…
Reference in New Issue
Block a user