Skip to content

Commit

Permalink
merge marked renderer function instead of overiding it. (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
reverland authored and QingWei-Li committed Feb 13, 2017
1 parent 287b0a6 commit 434e8d1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ And it can even be customized

```js
window.$docsify = {
markdown: function(marked) {
markdown: function(marked, renderer) {
// ...

return marked
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ window.$docsify = {

```js
window.$docsify = {
markdown: function(marked) {
markdown: function(marked, renderer) {
// ...

return marked
Expand Down
6 changes: 4 additions & 2 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
1 change: 0 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, ':')
}

0 comments on commit 434e8d1

Please sign in to comment.