New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-renderer-marked

Package Overview
Dependencies
Maintainers
5
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-renderer-marked - npm Package Compare versions

Comparing version 0.3.2 to 1.0.0

.git/index

3

index.js

@@ -6,5 +6,4 @@ /* global hexo */

var renderer = require('./lib/renderer');
var assign = require('object-assign');
hexo.config.marked = assign({
hexo.config.marked = Object.assign({
gfm: true,

@@ -11,0 +10,0 @@ pedantic: false,

'use strict';
var marked = require('marked');
var assign = require('object-assign');
var stripIndent = require('strip-indent');

@@ -20,16 +19,2 @@ var util = require('hexo-util');

// Support To-Do List
Renderer.prototype.listitem = function(text) {
var result;
if (/^\s*\[[x ]\]\s*/.test(text)) {
text = text.replace(/^\s*\[ \]\s*/, '<input type="checkbox"></input> ').replace(/^\s*\[x\]\s*/, '<input type="checkbox" checked></input> ');
result = '<li style="list-style: none">' + text + '</li>\n';
} else {
result = '<li>' + text + '</li>\n';
}
return result;
};
// Add id attribute to headings

@@ -87,2 +72,22 @@ Renderer.prototype.heading = function(text, level) {

// Support Basic Description Lists
Renderer.prototype.paragraph = function(text) {
var result = '';
var dlTest = /(^|\s)(\S.+)(<br>:(\s+))(\S.+)/;
var dl
= '<dl>'
+ '<dt>$2</dt>'
+ '<dd>$5</dd>'
+ '</dl>';
if (text.match(dlTest)) {
result = text.replace(dlTest, dl);
} else {
result = '<p>' + text + '</p>\n';
}
return result;
};
marked.setOptions({

@@ -100,5 +105,5 @@ langPrefix: '',

module.exports = function(data, options) {
return marked(data.text, assign({
return marked(data.text, Object.assign({
renderer: new Renderer()
}, this.config.marked, options));
};
{
"name": "hexo-renderer-marked",
"version": "0.3.2",
"version": "1.0.0",
"description": "Markdown renderer plugin for Hexo",

@@ -8,3 +8,2 @@ "main": "index",

"eslint": "eslint .",
"jscs": "jscs .",
"test": "mocha test/index.js",

@@ -30,4 +29,3 @@ "test-cov": "istanbul cover --print both _mocha -- test/index.js"

"hexo-util": "^0.6.2",
"marked": "^0.3.9",
"object-assign": "^4.1.1",
"marked": "^0.6.1",
"strip-indent": "^2.0.0"

@@ -37,10 +35,11 @@ },

"chai": "^4.1.2",
"eslint": "^4.13.1",
"babel-eslint": "^8.0.3",
"eslint-config-hexo": "^2.0.0",
"eslint": "^5.9.0",
"babel-eslint": "^10.0.1",
"eslint-config-hexo": "^3.0.0",
"istanbul": "^0.4.5",
"jscs": "^3.0.7",
"jscs-preset-hexo": "^1.0.1",
"mocha": "^4.0.1"
"mocha": "^6.0.0"
},
"engines": {
"node": ">=6.9.0"
}
}

@@ -7,3 +7,3 @@ # hexo-renderer-marked

Add support for [Markdown]. This plugin uses [marked] as render engine.
Add support for [Markdown]. This plugin uses [marked] as its render engine.

@@ -43,6 +43,50 @@ ## Installation

- **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.
- **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 `<a href="https://hexo.io">https://hexo.io</a>`.
## Extras
### Definition/Description Lists
`hexo-renderer-marked` also implements description/definition lists using the same syntax as [PHP Markdown Extra][PHP Markdown Extra].
This Markdown:
```markdown
Definition Term
: This is the definition for the term
```
will generate this html:
```html
<dl>
<dt>Definition Term</dt>
<dd>This is the definition for the term</dd>
</dl>
```
Note: There is currently a limitation in this implementation. If multiple definitions are provided, the rendered HTML will be incorrect.
For example, this Markdown:
```markdown
Definition Term
: Definition 1
: Definition 2
```
will generate this HTML:
```html
<dl>
<dt>Definition Term<br>: Definition 1</dt>
<dd>Definition 2</dd>
</dl>
```
If you've got ideas on how to support multiple definitions, please provide a pull request. We'd love to support it.
[Markdown]: https://daringfireball.net/projects/markdown/
[marked]: https://github.com/chjj/marked
[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/#def-list
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc