Skip to content

xiefucai/marked-admonition-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marked-admonition-extension

This is a marked admonition extension, to render out a nice warning message with simple markdown syntax, both support ESM and CJS.

Warning: you must use Marked to use this extension!

Usage

you can use abstractattentionbugcautiondangererrorexamplefailurehintinfonotequestionquotesuccesstipwarning as their theme;

the below code can be used in node.js, base CommonJs.

const { marked } = require('marked');
const admonition = require('marked-admonition-extension');

// custom tag name and class name (note: only version greater than v0.0.2 support)
// admonition.setConfig({ nodeName: 'details', className: 'details', title: { nodeName: 'summary' } });

// import the css file
require('marked-admonition-extension/dist/index.css');

marked.use(admonition.default);

const content = marked.parse(`!!! note this is a \`note\` type admonition
The warning above was a \`note\` type admonition
!!!`);

console.log(content);

it will output

<div class="admonition admonition-info">
    <p class="admonition-title">this is a <code>info</code> type admonition</p>
    <p>The warning above was a <code>info</code> type admonition</p>
</div>

admonition note image

Demo

Checkout the demo page to see marked in action ⛹️. Or you can edit and view preview result in markdown editor.

License

Copyright (c) 2011-2023, Fucai.xie. (MIT License)

About

an admonition extension for marked

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published