Socket
Socket
Sign inDemoInstall

micromark-extension-gfm

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-gfm - npm Package Compare versions

Comparing version 0.3.3 to 1.0.0

index.d.ts

49

index.js

@@ -1,1 +0,48 @@

module.exports = require('./syntax')
/**
* @typedef {import('micromark-util-types').Extension} Extension
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
* @typedef {import('micromark-extension-gfm-strikethrough').Options} Options
*/
import {
combineExtensions,
combineHtmlExtensions
} from 'micromark-util-combine-extensions'
import {
gfmAutolinkLiteral,
gfmAutolinkLiteralHtml
} from 'micromark-extension-gfm-autolink-literal'
import {
gfmStrikethrough,
gfmStrikethroughHtml
} from 'micromark-extension-gfm-strikethrough'
import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'
import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter'
import {
gfmTaskListItem,
gfmTaskListItemHtml
} from 'micromark-extension-gfm-task-list-item'
/**
* Support GFM or markdown on github.com.
*
* @param {Options} [options]
* @returns {Extension}
*/
export function gfm(options) {
return combineExtensions([
gfmAutolinkLiteral,
gfmStrikethrough(options),
gfmTable,
gfmTaskListItem
])
}
/** @type {HtmlExtension} */
export const gfmHtml = combineHtmlExtensions([
gfmAutolinkLiteralHtml,
gfmStrikethroughHtml,
gfmTableHtml,
gfmTagfilterHtml,
gfmTaskListItemHtml
])

76

package.json
{
"name": "micromark-extension-gfm",
"version": "0.3.3",
"version": "1.0.0",
"description": "micromark extension to support GFM (GitHub Flavored Markdown)",

@@ -29,44 +29,46 @@ "license": "MIT",

],
"types": "types/index.d.ts",
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"types/*.d.ts",
"index.js",
"html.js",
"syntax.js"
"index.d.ts",
"index.js"
],
"dependencies": {
"micromark": "~2.11.0",
"micromark-extension-gfm-autolink-literal": "~0.5.0",
"micromark-extension-gfm-strikethrough": "~0.6.5",
"micromark-extension-gfm-table": "~0.4.0",
"micromark-extension-gfm-tagfilter": "~0.3.0",
"micromark-extension-gfm-task-list-item": "~0.3.0"
"micromark-extension-gfm-autolink-literal": "^1.0.0",
"micromark-extension-gfm-strikethrough": "^1.0.0",
"micromark-extension-gfm-table": "^1.0.0",
"micromark-extension-gfm-tagfilter": "^1.0.0",
"micromark-extension-gfm-task-list-item": "^1.0.0",
"micromark-util-combine-extensions": "^1.0.0",
"micromark-util-types": "^1.0.0"
},
"devDependencies": {
"dtslint": "^4.0.0",
"hast-util-select": "^4.0.0",
"hast-util-to-text": "^2.0.0",
"node-fetch": "^2.6.1",
"nyc": "^15.0.0",
"@types/hast": "^2.3.1",
"@types/node-fetch": "^2.5.10",
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"hast-util-select": "^5.0.0",
"hast-util-to-text": "^3.0.0",
"micromark": "^3.0.0",
"node-fetch": "^2.0.0",
"prettier": "^2.0.0",
"rehype-parse": "^7.0.1",
"rehype-parse": "^7.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"unified": "^9.0.0",
"xo": "^0.38.0"
"xo": "^0.39.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" \"script/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test-types": "dtslint types",
"test": "npm run format && npm run test-coverage && npm run test-types"
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node --conditions development test/index.js",
"test": "npm run build && npm run format && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {

@@ -81,11 +83,3 @@ "tabWidth": 2,

"xo": {
"prettier": true,
"esnext": false,
"ignores": [
"types"
],
"rules": {
"guard-for-in": "off",
"unicorn/no-array-for-each": "off"
}
"prettier": true
},

@@ -96,3 +90,9 @@ "remarkConfig": {

]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

@@ -17,8 +17,10 @@ # micromark-extension-gfm

You probably shouldn’t use this package directly, but instead use
[`mdast-util-gfm`][mdast-util-gfm] with **[mdast][]** or `remark-gfm` with
**[remark][]**.
## When to use this
Alternatively, the extensions can be used separately:
If you’re using [`micromark`][micromark] or
[`mdast-util-from-markdown`][from-markdown], use this package.
Alternatively, if you’re using **[remark][]**, use [`remark-gfm`][remark-gfm].
If you don’t need all of GFM, the extensions can be used separately:
* [`micromark/micromark-extension-gfm-autolink-literal`](https://github.com/micromark/micromark-extension-gfm-autolink-literal)

@@ -37,2 +39,5 @@ — support GFM [autolink literals][]

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
[npm][]:

@@ -74,19 +79,16 @@

And our script, `example.js`, looks as follows:
And our module, `example.js`, looks as follows:
```js
var fs = require('fs')
var micromark = require('micromark')
var gfmSyntax = require('micromark-extension-gfm')
var gfmHtml = require('micromark-extension-gfm/html')
import fs from 'node:fs'
import {micromark} from 'micromark'
import {gfm, gfmHtml} from 'micromark-extension-gfm'
var doc = fs.readFileSync('example.md')
var result = micromark(doc, {
const output = micromark(fs.readFileSync('example.md'), {
allowDangerousHtml: true,
extensions: [gfmSyntax()],
extensions: [gfm()],
htmlExtensions: [gfmHtml]
})
console.log(result)
console.log(output)
```

@@ -124,17 +126,15 @@

### `html`
This package exports the following identifiers: `gfm`, `gfmHtml`.
There is no default export.
### `syntax(options?)`
### `gfm(options?)`
> Note: `syntax` is the default export of this module, `html` is available at
> `micromark-extension-gfm/html`.
### `gfmHtml`
Support [GFM][] or markdown on github.com.
`gfm` is a function that can be called with options and returns an extension for
micromark to parse GFM (can be passed in `extensions`).
`gfmHtml` is an extension for micromark to compile as elements (can be passed in
`htmlExtensions`).
The export of `syntax` is a function that can be called with options and returns
extension for the micromark parser (to tokenize GFM; can be passed in
`extensions`).
The export of html is an extension for the default HTML compiler (can be passed
in `htmlExtensions`).
##### `options`

@@ -232,8 +232,6 @@

[mdast]: https://github.com/syntax-tree/mdast
[remark-gfm]: https://github.com/remarkjs/remark-gfm
[gfm]: https://github.github.com/gfm/
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
[strikethrough]: https://github.github.com/gfm/#strikethrough-extension-

@@ -240,0 +238,0 @@

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