diff options
-rw-r--r-- | .meteor/packages | 1 | ||||
-rw-r--r-- | .meteor/versions | 3 | ||||
-rwxr-xr-x | packages/markdown/markdown.js | 9 | ||||
-rwxr-xr-x | packages/markdown/package.js | 18 | ||||
-rw-r--r-- | packages/markdown/src/checkNpmVersions.js | 5 | ||||
-rwxr-xr-x | packages/markdown/src/markdown.js | 9 | ||||
-rwxr-xr-x | packages/markdown/src/template-integration.js | 18 | ||||
-rwxr-xr-x | packages/markdown/template-integration.js | 16 |
8 files changed, 46 insertions, 33 deletions
diff --git a/.meteor/packages b/.meteor/packages index ba278f34..cb115111 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -98,3 +98,4 @@ percolate:synced-cron easylogic:summernote cfs:filesystem ostrio:cookies +tmeasday:check-npm-versions diff --git a/.meteor/versions b/.meteor/versions index 127079d4..b46280c4 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -177,6 +177,7 @@ templating@1.3.2 templating-compiler@1.3.3 templating-runtime@1.3.2 templating-tools@1.1.2 +tmeasday:check-npm-versions@0.3.2 tracker@1.2.0 twbs:bootstrap@3.3.6 ui@1.0.13 @@ -191,7 +192,7 @@ webapp-hashing@1.0.9 wekan-accounts-cas@0.1.0 wekan-accounts-oidc@1.0.10 wekan-ldap@0.0.2 -wekan-markdown@1.0.8 +wekan-markdown@1.0.9 wekan-oidc@1.0.12 wekan-scrollbar@3.1.3 yasaricli:slugify@0.0.7 diff --git a/packages/markdown/markdown.js b/packages/markdown/markdown.js deleted file mode 100755 index bb015cc4..00000000 --- a/packages/markdown/markdown.js +++ /dev/null @@ -1,9 +0,0 @@ -var mark = marked; - -mark.setOptions({ - gfm: true, - tables: true, - breaks: true -}); - -Markdown = mark; diff --git a/packages/markdown/package.js b/packages/markdown/package.js index 0838922b..55228856 100755 --- a/packages/markdown/package.js +++ b/packages/markdown/package.js @@ -2,23 +2,27 @@ Package.describe({ name: 'wekan-markdown', - summary: "GitHub flavored markdown parser for Meteor based on marked.js", - version: "1.0.8", - git: "https://github.com/wekan/markdown.git" + summary: 'GitHub flavored markdown parser for Meteor based on marked.js', + version: '1.0.9', + git: 'https://github.com/wekan/markdown.git', }); // Before Meteor 0.9? if(!Package.onUse) Package.onUse = Package.on_use; Package.onUse(function (api) { - if(api.versionsFrom) api.versionsFrom('METEOR@0.9.0'); + if(api.versionsFrom) api.versionsFrom('1.8.2'); api.use('templating'); + api.use("ecmascript", ['server', 'client']); api.add_files('marked/lib/marked.js', ['server', 'client']); - api.add_files('markdown.js', ['server', 'client']); + api.add_files('src/markdown.js', ['server', 'client']); api.export('Markdown', ['server', 'client']); - api.use("ui", "client", {weak: true}); - api.add_files("template-integration.js", "client"); + api.use('ui', 'client', {weak: true}); + api.use('tmeasday:check-npm-versions', 'client'); + + api.add_files('src/checkNpmVersions.js', 'client'); + api.add_files('src/template-integration.js', 'client'); }); diff --git a/packages/markdown/src/checkNpmVersions.js b/packages/markdown/src/checkNpmVersions.js new file mode 100644 index 00000000..350ca549 --- /dev/null +++ b/packages/markdown/src/checkNpmVersions.js @@ -0,0 +1,5 @@ +import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions'; + +checkNpmVersions({ + 'xss': '1.0.6', +}, 'my:xss'); diff --git a/packages/markdown/src/markdown.js b/packages/markdown/src/markdown.js new file mode 100755 index 00000000..8e003f26 --- /dev/null +++ b/packages/markdown/src/markdown.js @@ -0,0 +1,9 @@ +import marked from '../marked/lib/marked.js'; + +marked.setOptions({ + gfm: true, + tables: true, + breaks: true, +}); + +Markdown = marked; diff --git a/packages/markdown/src/template-integration.js b/packages/markdown/src/template-integration.js new file mode 100755 index 00000000..bd8eec47 --- /dev/null +++ b/packages/markdown/src/template-integration.js @@ -0,0 +1,18 @@ +import sanitizeXss from 'xss'; + +if (Package.ui) { + const Template = Package.templating.Template; + const UI = Package.ui.UI; + const HTML = Package.htmljs.HTML; + const Blaze = Package.blaze.Blaze; // implied by `ui` + + UI.registerHelper('markdown', new Template('markdown', function () { + const self = this; + let text = ''; + if (self.templateContentBlock) { + text = Blaze._toText(self.templateContentBlock, HTML.TEXTMODE.STRING); + } + + return HTML.Raw(sanitizeXss(Markdown(text))); + })); +} diff --git a/packages/markdown/template-integration.js b/packages/markdown/template-integration.js deleted file mode 100755 index 301bde31..00000000 --- a/packages/markdown/template-integration.js +++ /dev/null @@ -1,16 +0,0 @@ -if (Package.ui) { - var Template = Package.templating.Template; - var UI = Package.ui.UI; - var HTML = Package.htmljs.HTML; - var Blaze = Package.blaze.Blaze; // implied by `ui` - - UI.registerHelper('markdown', new Template('markdown', function () { - var self = this; - var text = ""; - if(self.templateContentBlock) { - text = Blaze._toText(self.templateContentBlock, HTML.TEXTMODE.STRING); - } - - return HTML.Raw(Markdown(text)); - })); -} |