Browse Source

Use twemoji for demo

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
94eb7f0b42
  1. 1
      support/demo_template/index.jade
  2. 5
      support/demo_template/index.js
  3. 4
      support/demo_template/index.styl
  4. 2
      support/demo_template/sample.md

1
support/demo_template/index.jade

@ -18,6 +18,7 @@ html
link(rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css') link(rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css')
script(src='markdown-it.js') script(src='markdown-it.js')
script(src='https://twemoji.maxcdn.com/twemoji.min.js')
script(src='plugins/markdown-it-emoji.js') script(src='plugins/markdown-it-emoji.js')
link(rel='stylesheet' href='index.css') link(rel='stylesheet' href='index.css')

5
support/demo_template/index.js

@ -68,6 +68,11 @@
mdHtml.renderer.rules.table_open = function () { mdHtml.renderer.rules.table_open = function () {
return '<table class="table table-striped">\n'; return '<table class="table table-striped">\n';
}; };
// Replace emoji codes with images
mdHtml.renderer.rules.emoji = function(token, idx) {
console.log(token[idx].name);
return window.twemoji.parse(token[idx].to);
};
// //
// Inject line numbers for sync scroll. Notes: // Inject line numbers for sync scroll. Notes:

4
support/demo_template/index.styl

@ -7,6 +7,10 @@ body
padding-bottom 160px padding-bottom 160px
background-color #fbfbfb background-color #fbfbfb
// hack to allign emojies to line height
.emoji
height: 1.2em;
.demo-options .demo-options
margin-bottom 30px margin-bottom 30px

2
support/demo_template/sample.md

@ -10,7 +10,7 @@ You will like those projects!
--- ---
# h1 Heading # h1 Heading 8-)
## h2 Heading ## h2 Heading
### h3 Heading ### h3 Heading
#### h4 Heading #### h4 Heading

Loading…
Cancel
Save