Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: docsifyjs/docsify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.10.0
Choose a base ref
...
head repository: docsifyjs/docsify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.10.1
Choose a head ref
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 25, 2017

  1. Fix render emojis

    QingWei-Li committed Jan 25, 2017

    Verified

    This commit was signed with the committer’s verified signature.
    jvnipers Juniper
    Copy the full SHA
    11f77cd View commit details
  2. bump 1.10.1

    QingWei-Li committed Jan 25, 2017
    Copy the full SHA
    bda1b76 View commit details
  3. -> v1.10.1

    QingWei-Li committed Jan 25, 2017
    Copy the full SHA
    c9739e7 View commit details
Showing with 31 additions and 14 deletions.
  1. +4 −0 CHANGELOG.md
  2. +11 −5 lib/docsify.js
  3. +2 −2 lib/docsify.min.js
  4. +1 −1 package.json
  5. +6 −6 src/render.js
  6. +7 −0 src/util.js
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.10.1
### Bug fixes
- Fix render emojis

## 1.10.0
### Features
- Support emoji :laughing:
16 changes: 11 additions & 5 deletions lib/docsify.js
Original file line number Diff line number Diff line change
@@ -168,6 +168,12 @@ var merge = Object.assign || function (to) {
return to
};

function emojify (text) {
return text
.replace(/:(\S*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
.replace(/__colon__/g, ':')
}

/**
* Active sidebar when scroll
* @link https://buble.surge.sh/
@@ -2510,7 +2516,7 @@ function init (options) {

var hl = prism.highlight(code, prism.languages[lang] || prism.languages.markup);

return ("<pre v-pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + hl + "</code></pre>")
return ("<pre v-pre data-lang=\"" + lang + "\"><code class=\"lang-" + lang + "\">" + (hl.replace(/:/g, '__colon__')) + "</code></pre>")
};
renderer.link = function (href, title, text) {
if (OPTIONS$1.router && !/:/.test(href)) {
@@ -2528,16 +2534,16 @@ function init (options) {
return ("<p>" + text + "</p>")
};

renderer.text = function (text) {
return text.replace(/:(\S*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
};

if (typeof OPTIONS$1.markdown === 'function') {
markdown.setOptions({ renderer: renderer });
markdown = OPTIONS$1.markdown.call(this, markdown);
} else {
markdown.setOptions(merge({ renderer: renderer }, OPTIONS$1.markdown));
}

var md = markdown;

markdown = function (text) { return emojify(md(text)); };
}

/**
Loading