New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

starkdown

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

starkdown - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

dist/starkdown.cjs

130

package.json
{
"name": "starkdown",
"description": "Transform Markdown into HTML.",
"version": "2.0.0",
"main": "./dist/snarkdown.js",
"module": "./dist/snarkdown.es.js",
"modern": "./dist/snarkdown.modern.js",
"umd:main": "./dist/snarkdown.umd.js",
"unpkg": "./dist/snarkdown.umd.js",
"types": "./snarkdown.d.ts",
"sideEffects": false,
"type": "module",
"version": "3.0.0",
"description": "Tiny <2kb Markdown parser written, almost as fast and smart as Tony Stark",
"main": "./dist/starkdown.cjs",
"module": "./dist/starkdown.es.js",
"modern": "./dist/starkdown.modern.js",
"umd:main": "./dist/starkdown.umd.js",
"unpkg": "./dist/starkdown.umd.js",
"types": "./dist/types/src/index.d.ts",
"exports": {
".": {
"import": "./dist/starkdown.es.js",
"require": "./dist/starkdown.cjs",
"types": "./dist/types/src/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"build": "microbundle",
"dev": "microbundle watch",
"test": "eslint src test && NODE_ENV=test mocha --compilers @babel/register",
"prepublish": "npm run -s build",
"release": "npm run -s build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
"lint": "tsc --noEmit && eslint ./src --ext .ts",
"test": "vitest run",
"release": "npm run lint && del dist && npm run build && np"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"del-cli": "^5.0.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-tree-shaking": "^1.10.0",
"microbundle": "^0.15.1",
"np": "^7.6.2",
"prettier": "^2.7.1",
"rollup": "^2.79.0",
"rollup-plugin-typescript2": "^0.33.0",
"typescript": "^4.8.3",
"vite": "^3.1.0",
"vitest": "^0.23.1"
},
"authors": [
"Jason Miller <jason@developit.ca>"
"Jason Miller <jason@developit.ca>",
"Luca Ban - Mesqueeb"
],
"files": [
"src",
"dist",
"snarkdown.d.ts"
],
"homepage": "https://github.com/developit/snarkdown",
"repository": "developit/snarkdown",
"funding": "https://github.com/sponsors/mesqueeb",
"homepage": "https://github.com/cycraft/starkdown#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/cycraft/starkdown.git"
},
"bugs": {
"url": "https://github.com/cycraft/starkdown/issues"
},
"license": "MIT",
"keywords": [
"markdown",
"snarkdown",
"starkdown",
"markdown-it",
"gfm",

@@ -36,39 +70,33 @@ "md",

],
"devDependencies": {
"@babel/preset-env": "^7.11.5",
"@babel/register": "^7.11.5",
"chai": "^3.5.0",
"eslint": "^7.7.0",
"eslint-config-developit": "^1.2.0",
"microbundle": "^0.12.0",
"mocha": "^5.1.1",
"npm-merge-driver-install": "^1.1.1"
"np": {
"yarn": false,
"branch": "production"
},
"eslintConfig": {
"extends": "developit",
"env": {
"browser": true,
"mocha": true,
"node": true,
"es6": true
},
"globals": {
"expect": true
},
"ignorePatterns": [
"node_modules",
"dist",
"scripts",
"test"
],
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"tree-shaking"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"jest/valid-expect": 0,
"no-console": 1,
"no-cond-assign": 0,
"no-regex-spaces": 0
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"tree-shaking/no-side-effects-in-initialization": "error",
"@typescript-eslint/ban-ts-comment": "off"
}
},
"babel": {
"env": {
"test": {
"presets": [
"@babel/preset-env"
]
}
}
}
}

@@ -1,53 +0,155 @@

<p align="center">
<img src="https://cdn.jsdelivr.net/emojione/assets/svg/1f63c.svg" width="256" height="256" alt="Snarkdown">
</p>
<h1 align="center">
Snarkdown
<a href="https://www.npmjs.org/package/snarkdown">
<img src="https://img.shields.io/npm/v/snarkdown.svg?style=flat" alt="npm">
</a>
</h1>
# Starkdown 🦾
Snarkdown is a dead simple **1kb** [Markdown] parser.
<a href="https://www.npmjs.com/package/starkdown"><img src="https://img.shields.io/npm/v/starkdown.svg" alt="Total Downloads"></a>
<a href="https://www.npmjs.com/package/starkdown"><img src="https://img.shields.io/npm/dw/starkdown.svg" alt="Latest Stable Version"></a>
It's designed to be as minimal as possible, for constrained use-cases where a full Markdown parser would be inappropriate.
Starkdown is a Tiny <2kb Markdown parser written, almost as fast and smart as Tony Stark.
```sh
npm i starkdown
```
## Features
## Motivation
- **Fast:** since it's basically one regex and a huge if statement
- **Tiny:** it's 1kb of gzipped ES3
- **Simple:** pass a Markdown string, get back an HTML string
It is a continuation on a similar package called [Snarkdown](https://github.com/developit/snarkdown), which had stopped development at 1kb, but doesn't include basic support for paragraphs, tables, fenced divs, etc.
> **Note:** Tables are not yet supported. If you love impossible to read regular expressions, submit a PR!
>
> **Note on XSS:** Snarkdown [doesn't sanitize HTML](https://github.com/developit/snarkdown/issues/70), since its primary target usage doesn't require it.
Starkdown stays around 1.6kb and adds these additional enhancements:
## Demos & Examples
- [Paragraphs](#paragraphs)
- [Tables](#tables)
- [Fenced Divs](#fenced-divs)
- [Formating done Right](#formating-done-right)
- ⚛️ [**Snarky**](https://snarky.surge.sh) - markdown editor built with Preact & Snarkdown
- ✏️ [**Simple Markdown Editor**](http://jsfiddle.net/developit/828w6t1x/)
## Usage
Starkdown is really easy to use, a single function which parses a string of Markdown and returns a String of HTML. Couldn't be simpler.
## Usage
```js
import { starkdown } from 'starkdown'
Snarkdown exports a single function, which parses a string of Markdown and returns a String of HTML. Couldn't be simpler.
const md = '_This_ is **easy** to `use`.'
const html = starkdown(md)
console.log(html)
```
The snarkdown module is available in [every module format](https://unpkg.com/snarkdown/dist/) you'd ever need: ES Modules, CommonJS, UMD...
The html returned will look like:
```js
import snarkdown from 'snarkdown';
```html
<p><em>This</em> is <strong>easy</strong> to <code>use</code>.</p>
```
let md = '_this_ is **easy** to `use`.';
let html = snarkdown(md);
console.log(html);
// <em>this</em> is <strong>easy</strong> to <code>use</code>.
### Paragraphs
With most Markdown implementations, paragraphs are wrapped in `<p>` tags. With Starkdown, this is no different.
- All paragraphs and "inline" elements are wrapped in a `<p>` tags
(See [List of "inline" elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements#list_of_inline_elements) on MDN)
- Eg. a standalone image will still be wrapped in a `<p>` tag, because it's an inline element.
- All non-inline elements will not be wrapped in `<p>` tags
- Eg. a table will not be wrapped in a `<p>` tag.
```md
Check [github](https://github.com)
Img: ![](/some-image.png)
```
### Add-ons and Libraries
converts to
- For Webpack users, [`snarkdown-loader`](https://github.com/Plugin-contrib/snarkdown-loader) renders markdown files to html.
```html
<p>Check <a href="https://github.com">github</a></p><p>Img: <img src="/some-image.png" alt="" /></p>
```
But also, when _just_ using images and links:
```md
[github](https://github.com)
[Markdown]: http://daringfireball.net/projects/markdown/
![](/some-image.png)
```
converts to
```html
<p><a href="https://github.com">github</a></p><p><img src="/some-image.png" alt="" /></p>
```
In contrast, non-inline elements won't get a `<p>` tag:
```md
### Usage
\`\`\`js
const a = 1
\`\`\`
```
converts to
```html
<h3>Usage</h3><pre class="code js"><code class="language-js">const a = 1</code></pre>
```
### Tables
```md
| My | Table |
```
converts to
```html
<table><tr><td>My</td><td>Table</td></tr></table>
```
### Fenced Divs
```md
:::
this is some info
:::
```
converts to
```html
<div class="fenced "><p>this is some info</p></div>
```
**Or with a custom class.**
```md
::: info
this is some info
:::
```
converts to
```html
<div class="fenced info"><p>this is some info</p></div>
```
### Formating done Right
You need to pad your formatting with spaces in order to correctly convert sentences like these:
```md
snake_case is _so-so_
```
correctly converts to
```html
<!-- in this library -->
<p>snake_case is <em>so-so</em></p>
<!-- but in Snarkdown... -->
<p>snake<em>case is </em>so-so<em></em></p>
```
I have greatly simplified the complex logic of Snarkdown and fixed formatting issues like these.
## Security
**Note on XSS:** Starkdown doesn't sanitize HTML. Please bring your own HTML sanitation for any place where user input will be converted into HTML.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc