@fsegurai/marked-extended-typographic
v15.0.0
Published
Extended Typographic for Marked.js
Downloads
76
Maintainers
Readme
A library of extended lists for Marked.js.
@fsegurai/marked-extended-typographic
is an extensions for Marked.js that adds support for extended typographic characters to easily translate plain ASCII punctuation characters into "smart" typographic punctuation HTML entities.
Table of contents
Installation
@fsegurai/marked-extended-typographic
To add @fsegurai/marked-extended-typographic
along with Marked.js to your package.json
use the following commands.
npm install @fsegurai/marked-extended-typographic marked@^12.0.2 --save
Using Extended Lists
Import @fsegurai/marked-extended-typographic
and apply it to your Marked instance as shown below.
import { marked } from 'marked'
import markedExtendedTypographic from '@fsegurai/marked-extended-typographic'
// or UMD script
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/@fsegurai/marked-extended-typographic/lib/index.umd.js"></script>
marked.use(markedExtendedTypographic())
const exampleMarkdown = `
He said, -- \"A 'simple' sentence. . .\" --- unknown
(omega) - (alpha) - (beta)
Copyright (C) 2024. All rights reserved.
`
marked.parse(exampleMarkdown)
// Output:
// <p>He said, — "A 'simple' sentence. . ." — unknown</p>
// <p>(ω) - (α) - (β)</p>
// <p>Copyright © 2024. All rights reserved.</p>
Read the Marked.js documentation for more details about its usage.
Available Extensions
Demo Application
To see all themes in action, check out the demo: https://fsegurai.github.io/marked-extensions.
To set up the demo locally:
git clone https://github.com/fsegurai/marked-extensions.git
npm install
npm start
This will serve the application locally at http://[::1]:8000.
License
Licensed under MIT.