Installations
npm install mdast-util-from-span-markdown
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
16.9.0
NPM Version
7.21.1
Score
72.1
Supply Chain
98.9
Quality
75.6
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (93.61%)
JavaScript (6.39%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
signalwerk
Download Statistics
Total Downloads
4,817
Last Day
1
Last Week
4
Last Month
58
Last Year
757
GitHub Statistics
MIT License
22 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Oct 25, 2021
Bundle Size
1.82 kB
Minified
964.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.6
Package Id
mdast-util-from-span-markdown@1.0.6
Unpacked Size
21.86 kB
Size
6.99 kB
File Count
14
NPM Version
7.21.1
Node Version
16.9.0
Total Downloads
Cumulative downloads
Total Downloads
4,817
Last Day
0%
1
Compared to previous day
Last Week
-78.9%
4
Compared to previous week
Last Month
205.3%
58
Compared to previous month
Last Year
-40%
757
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
mdast-util-from-span-markdown
The aim of this repo is to have a minimalistic parser (TypeScript) for span elements written in markdown syntax.
The output is an abstract syntax tree mostly compatible to mdast.
Install
1npm i mdast-util-from-span-markdown
Use
1import fromMarkdown from "mdast-util-from-span-markdown"; 2const md = "Say **Hello** [World](https://example.com) in `code`! *Thanks!*"; 3 4fromMarkdown(md);
Return
1[ 2 { 3 type: "text", 4 value: "Say ", 5 }, 6 { 7 type: "strong", 8 children: [ 9 { 10 type: "text", 11 value: "Hello", 12 }, 13 ], 14 }, 15 { 16 type: "text", 17 value: " ", 18 }, 19 { 20 type: "link", 21 url: "https://example.com", 22 children: [ 23 { 24 type: "text", 25 value: "World", 26 }, 27 ], 28 }, 29 { 30 type: "text", 31 value: " in ", 32 }, 33 { 34 type: "inlineCode", 35 value: "code", 36 }, 37 { 38 type: "text", 39 value: "! ", 40 }, 41 { 42 type: "emphasis", 43 children: [ 44 { 45 type: "text", 46 value: "Thanks!", 47 }, 48 ], 49 }, 50];
Technical decission
- The code has to be as small as possible (regex instead of regular parsing)
- The output has to be as «correct» as possible according to mast specs and CommonMark
Why
Because this is not a full markdown parser (see remark otherwise) with support for block elements, this code is especially handy for «one-line markdown». Think for example about translations comming from a system that does not support rich text formatting.
Render
If you like to render the output of fromMarkdown()
in a frontend-framework have a look at the examples/md.tsx
for react or examples/md.vue
for vue.
The examples are not included in the npm-package. You need to get a copy of the example and adjust it to your needs:
1# react 2curl https://raw.githubusercontent.com/signalwerk/mdast-util-from-span-markdown/main/examples/md.tsx > md.tsx 3 4# vue 5curl https://raw.githubusercontent.com/signalwerk/mdast-util-from-span-markdown/main/examples/md.vue > md.vue
Thank you

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
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- 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 'main'
Reason
21 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.7
/10
Last Scanned on 2025-02-03
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