habitica-markdown
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "habitica-markdown", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A markdown-it module pre-configured for use in Habitica", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
var markdownitEmoji = require('markdown-it-emoji'); | ||
var unicode = require('./data/unicode-emoji'); | ||
var vendoredShortcuts = require('./data/shortcut-emoji'); | ||
var specialCases = { | ||
'+1': '%2B1', // s3 urls can't have a + sign in them, use the html encoded version | ||
watch: 'watch-icon', // Firefox renders "watch" as the text `function watch() {[native code]}`. Maybe an Angular issue? | ||
}; | ||
function getShortcuts () { | ||
var shortcuts = JSON.parse(JSON.stringify(unicode)); | ||
Object.keys(vendoredShortcuts).forEach(function appendShortcuts (key) { | ||
shortcuts[key] = shortcuts[key] || []; | ||
shortcuts[key] = shortcuts[key].concat(vendoredShortcuts[key]); | ||
}); | ||
return shortcuts; | ||
} | ||
var shortcuts = getShortcuts(); | ||
// https://github.com/markdown-it/markdown-it-emoji/tree/4d5f6af1b6efb0975dae2ac51dbe6252636724aa#change-output | ||
function emojiPlugin (md) { | ||
md.use(markdownitEmoji); | ||
md.use(markdownitEmoji, { | ||
shortcuts: shortcuts, | ||
}); | ||
md.renderer.rules.emoji = function markdownEmojiRules (token, idx) { | ||
@@ -18,2 +38,3 @@ var emoji = token[idx].markup; | ||
var style = 'height: 1.5em; width: 1.5em'; | ||
return '<img class="habitica-emoji" style="' + style + '" src="' + src + '" alt="' + emoji + '">'; | ||
@@ -20,0 +41,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26428
10
954
1