From 483d99d364834520456f9e96b63f93ba4c2df07e Mon Sep 17 00:00:00 2001 From: curbengh <43627182+curbengh@users.noreply.github.com> Date: Fri, 2 Aug 2019 14:48:22 +0930 Subject: [PATCH] chore(deps): update marked to ^0.7.0 (#102) * chore(deps): update marked to ^0.7.0 * refactor: remove unused 'sanitize' option * feat: restore plugin sanitize function, rename to sanitizeUrl --- README.md | 6 ++---- index.js | 5 ++--- lib/renderer.js | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9c830dc..872589e 100644 --- a/README.md +++ b/README.md @@ -23,24 +23,22 @@ You can configure this plugin in `_config.yml`. marked: gfm: true pedantic: false - sanitize: false - tables: true breaks: true smartLists: true smartypants: true modifyAnchors: '' autolink: true + sanitizeUrl: false ``` - **gfm** - Enables [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown) - **pedantic** - Conform to obscure parts of `markdown.pl` as much as possible. Don't fix any of the original markdown bugs or poor behavior. -- **sanitize** - Sanitize the output. Ignore any HTML that has been input. -- **tables** - Enable GFM [tables](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables). This option requires the `gfm` option to be true. - **breaks** - Enable GFM [line breaks](https://help.github.com/articles/github-flavored-markdown#newlines). This option requires the `gfm` option to be true. - **smartLists** - Use smarter list behavior than the original markdown. - **smartypants** - Use "smart" typograhic punctuation for things like quotes and dashes. - **modifyAnchors** - Use for transform anchorIds. if `1` to lowerCase and if `2` to upperCase. **Must be integer**. - **autolink** - Enable autolink for URLs. E.g. `https://hexo.io` will become `https://hexo.io`. +- **sanitizeUrl** - Remove URLs that start with `javascript:`, `vbscript:` and `data:`. ## Extras diff --git a/index.js b/index.js index 8e87855..66505fe 100644 --- a/index.js +++ b/index.js @@ -7,13 +7,12 @@ var renderer = require('./lib/renderer'); hexo.config.marked = Object.assign({ gfm: true, pedantic: false, - sanitize: false, - tables: true, breaks: true, smartLists: true, smartypants: true, modifyAnchors: '', - autolink: true + autolink: true, + sanitizeUrl: false }, hexo.config.marked); hexo.extend.renderer.register('md', 'html', renderer, true); diff --git a/lib/renderer.js b/lib/renderer.js index 869357c..4fb2397 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -35,7 +35,7 @@ function anchorId(str, transformOption) { // Support AutoLink option Renderer.prototype.link = function(href, title, text) { - if (this.options.sanitize) { + if (this.options.sanitizeUrl) { let prot; try { diff --git a/package.json b/package.json index 0a09b04..46efceb 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "license": "MIT", "dependencies": { "hexo-util": "^0.6.3", - "marked": "^0.6.2", + "marked": "^0.7.0", "strip-indent": "^3.0.0" }, "devDependencies": {