Socket
Socket
Sign inDemoInstall

markdown-it-attrs

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-attrs - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

demo.md

9

index.js

@@ -51,2 +51,3 @@ 'use strict';

// add attributes
attrToken.info = "b";
utils.addAttrs(attrs, attrToken);

@@ -69,4 +70,12 @@ }

md.core.ruler.push('curly_attributes', curlyAttrs);
// render inline code blocks with attrs
md.renderer.rules.code_inline = renderCodeInline;
};
function renderCodeInline(tokens, idx, _, __, slf) {
var token = tokens[idx];
return '<code'+ slf.renderAttrs(token) +'>'
+ utils.escapeHtml(tokens[idx].content)
+ '</code>';
}
/**

@@ -73,0 +82,0 @@ * test if inline token has proper formated curly end

5

package.json
{
"name": "markdown-it-attrs",
"version": "0.1.1",
"version": "0.1.2",
"description": "Add classes, identifiers and attributes to your markdown with {} curly brackets, similar to pandoc's header attributes",

@@ -17,4 +17,3 @@ "license": "MIT",

"test": "mocha",
"prepublish": "mocha",
"postpublish": "git tag v$npm_package_version; git push --tags; git push"
"prepublish": "mocha"
},

@@ -21,0 +20,0 @@ "homepage": "https://github.com/arve0/markdown-it-attrs",

@@ -99,1 +99,24 @@ /**

}
/**
* from https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js
*/
var HTML_ESCAPE_TEST_RE = /[&<>"]/;
var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
var HTML_REPLACEMENTS = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;'
};
function replaceUnsafeChar(ch) {
return HTML_REPLACEMENTS[ch];
}
exports.escapeHtml = function(str) {
if (HTML_ESCAPE_TEST_RE.test(str)) {
return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
}
return str;
}
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