merge marked renderer function instead of overiding it. (#74)
This commit is contained in:
parent
287b0a6b30
commit
434e8d1a36
4 changed files with 6 additions and 5 deletions
|
|
@ -149,7 +149,7 @@ And it can even be customized
|
|||
|
||||
```js
|
||||
window.$docsify = {
|
||||
markdown: function(marked) {
|
||||
markdown: function(marked, renderer) {
|
||||
// ...
|
||||
|
||||
return marked
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ window.$docsify = {
|
|||
|
||||
```js
|
||||
window.$docsify = {
|
||||
markdown: function(marked) {
|
||||
markdown: function(marked, renderer) {
|
||||
// ...
|
||||
|
||||
return marked
|
||||
|
|
|
|||
|
|
@ -58,9 +58,11 @@ export function init () {
|
|||
}
|
||||
|
||||
if (typeof $docsify.markdown === 'function') {
|
||||
markdown.setOptions({ renderer })
|
||||
markdown = $docsify.markdown.call(this, markdown)
|
||||
markdown = $docsify.markdown.call(this, markdown, renderer)
|
||||
} else {
|
||||
if ($docsify.markdown.renderer) {
|
||||
$docsify.markdown.renderer = merge(renderer, $docsify.markdown.renderer)
|
||||
}
|
||||
markdown.setOptions(merge({ renderer }, $docsify.markdown))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,4 +164,3 @@ export function emojify (text) {
|
|||
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/__colon__/g, ':')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue