Markdown-it plugin providing ANSI output for terminal
Installations
npm install markdown-it-terminal
Developer
trabus
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
16.14.2
NPM Version
8.5.0
Statistics
23 Stars
72 Commits
11 Forks
2 Watching
5 Branches
6 Contributors
Updated on 09 Dec 2023
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
54,013,544
Last day
-13.3%
24,298
Compared to previous day
Last week
-11.2%
135,057
Compared to previous week
Last month
26%
636,205
Compared to previous month
Last year
5.3%
7,503,069
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
4
Peer Dependencies
1
Dev Dependencies
3
markdown-it-terminal
This is a plugin to provide ansi terminal output for markdown-it. It is heavily inspired by marked-terminal, a terminal renderer for the marked library.
This library is not officially supported by markdown-it.
Install
npm install markdown-it markdown-it-terminal
Usage
markdown-it
provides a method for extending it with plugins.
1var markdown = require('markdown-it'); 2var terminal = require('markdown-it-terminal'); 3 4markdown.use(terminal);
You can override the default options if you choose.
1var styles = require('ansi-styles'); 2var markdown = require('markdown-it'); 3var terminal = require('markdown-it-terminal'); 4 5var options = { 6 styleOptions: { 7 code: styles.green 8 } 9} 10markdown.use(terminal, options); 11// inline code now prints in green instead of the default yellow
Options
markdown-it-terminal
takes several options, most of which are to override existing defaults.
1var options = { 2 styleOptions:{}, 3 highlight: require('cardinal').highlight, 4 unescape: true, 5 indent: ' ' 6}
styleOptions
Styles are defined per token, and make use of the ansi-styles
library, which provides a number of open and close values for ansi codes.
In the most basic implementation, you can simply provide a supported style like so:
1var styles = require('ansi-styles'); 2 3var options = { 4 styleOptions: { 5 code: styles.green 6 } 7}
markdown-it-terminal
exposes a utility method to build compound styles, using an array of style names (must be supported by ansi-styles
).
1var styles = require('ansi-styles'); 2var terminal = require('markdown-it-terminal'); 3 4var options = { 5 styleOptions: { 6 code: terminal.compoundStyle(['green','underline']) 7 } 8}
The following tokens can be overridden through styleOptions:
- code
- blockquote
- html
- heading
- firstHeading
- hr
- listitem
- table
- paragraph
- strong
- em
- codespan
- del
- link
- href
highlight
Highlight function to parse code blocks. Should be a function that takes a string and outputs a formatted string.
unescape
Unescape content, true
by default.
indent
Indent all content under a heading (h1
..h6
) using this string. With indent: ' '
(two spaces):
Markdown | Rendered |
---|---|
# Heading 1 | Heading 1 |
Highlighting
markdown-it-terminal
uses the cardinal library
for code highlight support by default.
Windows Support
Because ansi is not supported on cmd.exe, markdown-it-terminal
only works on Windows shells with ansi support.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
7 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
Reason
Found 2/10 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 23 are checked with a SAST tool
Score
2.4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More