
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
gulp-markdown-it-adapter
Advanced tools
An adapter for Gulp to render Markdown files with Markdown-It
An adapter for Gulp to render Markdown files with Markdown-It.
It's not a wrapper, it's an adapter!
Why? I want to have full access to Markdown-It instance instead of place options to the wrapper.
This plugin is the same as gulp-markdown-it, but takes Markdown-It instance outside and written on pure JavaScript ES5.
Install as a development dependency:
npm install --save-dev gulp-markdown-it-adapter
Use in Gulpfile.js
:
var gulp = require( 'gulp' );
var MarkdownIt = require( 'markdown-it' );
var gulpMarkdownIt = require( 'gulp-markdown-it-adapter' );
var highlightJs = require( 'highlight.js' );
var concat = require( 'gulp-concat' );
var mdToc = require( 'markdown-it-toc-and-anchor' ).default;
var wrap = require( 'gulp-wrap' );
gulp.task(
'default',
function ()
{
var sourcePath = './docs/*.md';
var outputPath = './';
var outputFileName = 'docs';
var stylesPath = './styles';
var optionsMd = {
html: false,
xhtmlOut: true,
typographer: false,
linkify: false,
breaks: false,
highlight: highlight
};
var optionsToc = {
toc: true,
tocFirstLevel: 2,
tocLastLevel: 3,
anchorLink: false,
tocClassName: 'table-of-contents'
};
var md = new MarkdownIt( 'default', optionsMd );
md.use( mdToc, optionsToc );
return gulp.src( sourcePath )
.pipe( concat( outputFileName + '.md' ) )
.pipe( gulpMarkdownIt( md ) )
.pipe( wrap( {src: stylesPath + '/template.html'} ) )
.pipe( gulp.dest( outputPath ) );
}
);
function highlight( str, lang )
{
if ( lang && highlightJs.getLanguage( lang ) )
{
try
{
return highlightJs.highlight( lang, str ).value;
}
catch ( exception )
{
console.error( exception );
}
}
try
{
return highlightJs.highlightAuto( str ).value;
}
catch ( exception )
{
console.error( exception );
}
return '';
}
FAQs
An adapter for Gulp to render Markdown files with Markdown-It
The npm package gulp-markdown-it-adapter receives a total of 33 weekly downloads. As such, gulp-markdown-it-adapter popularity was classified as not popular.
We found that gulp-markdown-it-adapter 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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.