
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@inyur/markdown-to-html
Advanced tools
npm i -S @inyur/markdown-to-html
import md2html from '@inyur/markdown-to-html';
// Variant 1
const someMdFileContent = require('fs').readFileSync('./some.md', 'utf8');
const html = await md2html(someMdFileContent);
// Variant 2
// Internaly md2html has promise resolver if promise found and
// has object default getter.
const someMdFileContentPromised = import('./some.md')
.then(module=> module.defult);
const html = await md2html(someMdFileContentPromised);
// Or This simplified works too
const someMdFileContentPromised = import('./some.md');
const html = await md2html(someMdFileContentPromised);
// Or This simplified works too
const html = await md2html(import('./some.md'));
In general cases markdown-to-html return html string, except this called with special parameter extended
Advanced usage:
const options = {
}
const html = await md2html('Md text or promise or esmodule', options);
this is object of some props (see next)
Can be Array of (Objects of Strings or Functions) Can be Array of Functions Can be Object of Strings or Functions Can be Function
const options = {
links: [{
alfaUrl: 'https://alfa.net',
betaUrl: (url, node) => {
if (url.host !== 'internal.site') {
node.properties.target = '_blank'
}
return 'https://beta.com'
},
}]
}
Can be Object
const options = {
variables: {
someTextVariable: 'Some Value'
}
}
const html = await md2html('Md text ${someTextVariable}', options);
markdown-to-html return Object of:
const {
markdown, // initial markdown source
title, // returns if splitTitle prop is true
template, // Handlebars template, useful for reuse template
html, // Compiled template as === template(variables)
data, // Returned data from frontMatter
headings, // Returned H1-6 structure
toString, // Function for usage as text === toString() { return template(variables); }
} = await md2html('Md text or promise or esmodule', options);
Boolean, default false In extended version returned object with html without title and title prop.
FAQs
```bash npm i -S @inyur/markdown-to-html ```
We found that @inyur/markdown-to-html 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.