mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
WIP: markdown
This commit is contained in:
parent
232bc746f4
commit
1f85b25549
8 changed files with 46 additions and 33 deletions
|
@ -98,3 +98,4 @@ percolate:synced-cron
|
||||||
easylogic:summernote
|
easylogic:summernote
|
||||||
cfs:filesystem
|
cfs:filesystem
|
||||||
ostrio:cookies
|
ostrio:cookies
|
||||||
|
tmeasday:check-npm-versions
|
||||||
|
|
|
@ -177,6 +177,7 @@ templating@1.3.2
|
||||||
templating-compiler@1.3.3
|
templating-compiler@1.3.3
|
||||||
templating-runtime@1.3.2
|
templating-runtime@1.3.2
|
||||||
templating-tools@1.1.2
|
templating-tools@1.1.2
|
||||||
|
tmeasday:check-npm-versions@0.3.2
|
||||||
tracker@1.2.0
|
tracker@1.2.0
|
||||||
twbs:bootstrap@3.3.6
|
twbs:bootstrap@3.3.6
|
||||||
ui@1.0.13
|
ui@1.0.13
|
||||||
|
@ -191,7 +192,7 @@ webapp-hashing@1.0.9
|
||||||
wekan-accounts-cas@0.1.0
|
wekan-accounts-cas@0.1.0
|
||||||
wekan-accounts-oidc@1.0.10
|
wekan-accounts-oidc@1.0.10
|
||||||
wekan-ldap@0.0.2
|
wekan-ldap@0.0.2
|
||||||
wekan-markdown@1.0.8
|
wekan-markdown@1.0.9
|
||||||
wekan-oidc@1.0.12
|
wekan-oidc@1.0.12
|
||||||
wekan-scrollbar@3.1.3
|
wekan-scrollbar@3.1.3
|
||||||
yasaricli:slugify@0.0.7
|
yasaricli:slugify@0.0.7
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
var mark = marked;
|
|
||||||
|
|
||||||
mark.setOptions({
|
|
||||||
gfm: true,
|
|
||||||
tables: true,
|
|
||||||
breaks: true
|
|
||||||
});
|
|
||||||
|
|
||||||
Markdown = mark;
|
|
|
@ -2,23 +2,27 @@
|
||||||
|
|
||||||
Package.describe({
|
Package.describe({
|
||||||
name: 'wekan-markdown',
|
name: 'wekan-markdown',
|
||||||
summary: "GitHub flavored markdown parser for Meteor based on marked.js",
|
summary: 'GitHub flavored markdown parser for Meteor based on marked.js',
|
||||||
version: "1.0.8",
|
version: '1.0.9',
|
||||||
git: "https://github.com/wekan/markdown.git"
|
git: 'https://github.com/wekan/markdown.git',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Before Meteor 0.9?
|
// Before Meteor 0.9?
|
||||||
if(!Package.onUse) Package.onUse = Package.on_use;
|
if(!Package.onUse) Package.onUse = Package.on_use;
|
||||||
|
|
||||||
Package.onUse(function (api) {
|
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('templating');
|
||||||
|
api.use("ecmascript", ['server', 'client']);
|
||||||
|
|
||||||
api.add_files('marked/lib/marked.js', ['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.export('Markdown', ['server', 'client']);
|
||||||
|
|
||||||
api.use("ui", "client", {weak: true});
|
api.use('ui', 'client', {weak: true});
|
||||||
api.add_files("template-integration.js", "client");
|
api.use('tmeasday:check-npm-versions', 'client');
|
||||||
|
|
||||||
|
api.add_files('src/checkNpmVersions.js', 'client');
|
||||||
|
api.add_files('src/template-integration.js', 'client');
|
||||||
});
|
});
|
||||||
|
|
5
packages/markdown/src/checkNpmVersions.js
Normal file
5
packages/markdown/src/checkNpmVersions.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
|
||||||
|
|
||||||
|
checkNpmVersions({
|
||||||
|
'xss': '1.0.6',
|
||||||
|
}, 'my:xss');
|
9
packages/markdown/src/markdown.js
Executable file
9
packages/markdown/src/markdown.js
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
import marked from '../marked/lib/marked.js';
|
||||||
|
|
||||||
|
marked.setOptions({
|
||||||
|
gfm: true,
|
||||||
|
tables: true,
|
||||||
|
breaks: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
Markdown = marked;
|
18
packages/markdown/src/template-integration.js
Executable file
18
packages/markdown/src/template-integration.js
Executable file
|
@ -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)));
|
||||||
|
}));
|
||||||
|
}
|
|
@ -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));
|
|
||||||
}));
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue