
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
tent-markdown
Advanced tools
Tent Dialect for markdown-js.
npm install tent-markdown
### Node
var markdown = require( "tent-markdown" ).markdown;
console.log( markdown.toHTML( "Hello *World*! #firstwords", "Tent", { footnotes: [], hashtagURITemplate: 'http://example.com/search?hashtag={hashtag}' } ) );
<p>Hello <strong>World</strong>! <a href="http://example.com/search?hashtag=firstwords" rel="hashtag">#firstwords</a></p>
### Browser
<!DOCTYPE html>
<html>
<body>
<textarea id="text-input" oninput="this.editor.update()"
rows="6" cols="60">^[You](0), Type _Tent_ **Markdown** here.</textarea>
<div id="preview"> </div>
<script src="lib/tent-markdown.js"></script>
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value, 'Tent', { footnotes: ["https://entity.example.org"] });
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
</body>
</html>
The above example is adapted from markdown-js.
Simply put,
var source = "^[Example Mention](0), *Bold*, _Italic_, ~Strikethrough~, [Regular link](https://tent.io)...",
entity_uris = ["https://entity.example.org"];
window.markdown.toHTML( source, 'Tent', { footnotes: entity_uris } )
where entity_uris
is an Array
of entity uris with indices mapping to integer links in the markdown source.
The jsonml may be manipulated using preprocessors before it is translated into html.
addAttributeToLinks = function ( jsonml ) {
// Skip over anything that isn't a link
if (jsonml[0] !== 'link') return jsonml;
jsonml[1]['data-my-attribute'] = 'Hello World';
return jsonml;
}
var markdown = require( "tent-markdown" ).markdown;
console.log( markdown.toHTML( "https://example.com", "Tent", { preprocessors: [addAttributeToLinks] } ) );
<p><a href="https://example.com" data-my-attribute="Hello World">https://example.com</a></p>
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Tent dialect for markdown lib
The npm package tent-markdown receives a total of 6 weekly downloads. As such, tent-markdown popularity was classified as not popular.
We found that tent-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.