Socket
Socket
Sign inDemoInstall

remark-mdx

Package Overview
Dependencies
Maintainers
4
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-mdx - npm Package Compare versions

Comparing version 2.0.0-next.8 to 2.0.0-next.9

52

index.js
'use strict'
var parse = require('./lib/parse')
var serialize = require('./lib/serialize')
let syntaxMdx = require('micromark-extension-mdx')
let syntaxMdxjs = require('micromark-extension-mdxjs')
let fromMarkdown = require('mdast-util-mdx/from-markdown')
let toMarkdown = require('mdast-util-mdx/to-markdown')
let warningIssued
module.exports = mdx
// I think this is needed for webpack? 😔
mdx.default = mdx
function mdx(options) {
let settings = options || {}
let syntax = settings.js === false ? syntaxMdx : syntaxMdxjs
let data = this.data()
function mdx() {
var parser = this.Parser
var compiler = this.Compiler
if (isRemarkParser(parser)) {
parse(parser)
/* istanbul ignore next - old remark. */
if (
!warningIssued &&
((this.Parser &&
this.Parser.prototype &&
this.Parser.prototype.blockTokenizers) ||
(this.Compiler &&
this.Compiler.prototype &&
this.Compiler.prototype.visitors))
) {
warningIssued = true
console.warn(
'[remark-mdx] Warning: please upgrade to remark 13 to use this plugin'
)
}
if (isRemarkCompiler(compiler)) {
serialize(compiler)
add('micromarkExtensions', syntax(options))
add('fromMarkdownExtensions', fromMarkdown)
add('toMarkdownExtensions', toMarkdown)
function add(field, value) {
/* istanbul ignore if - other extensions. */
if (data[field]) data[field].push(value)
else data[field] = [value]
}
}
function isRemarkParser(parser) {
return Boolean(parser && parser.prototype && parser.prototype.blockTokenizers)
}
function isRemarkCompiler(compiler) {
return Boolean(compiler && compiler.prototype && compiler.prototype.visitors)
}
{
"name": "remark-mdx",
"version": "2.0.0-next.8",
"version": "2.0.0-next.9",
"description": "remark plugin to add support for mdx",

@@ -20,3 +20,2 @@ "repository": "https://github.com/mdx-js/mdx/tree/master/packages/remark-mdx",

"index.js",
"lib/",
"types/index.d.ts"

@@ -37,21 +36,16 @@ ],

"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"test": "npm run format && npm run test-coverage",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test-types": "dtslint types"
"test-types": "dtslint types",
"test": "yarn format && yarn test-coverage && yarn test-types"
},
"dependencies": {
"parse-entities": "^2.0.0",
"remark-stringify": "^8.1.0",
"stringify-entities": "^3.0.1",
"strip-indent": "^3.0.0",
"unist-util-stringify-position": "^2.0.3"
"mdast-util-mdx": "^0.1.1",
"micromark-extension-mdx": "^0.2.0",
"micromark-extension-mdxjs": "^0.3.0"
},
"devDependencies": {
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"remark-cli": "^8.0.0",
"remark-parse": "^8.0.2",
"remark-preset-wooorm": "^7.0.0",
"remark-parse": "^9.0.0",
"remark-stringify": "^9.0.1",
"tape": "^5.0.1",

@@ -61,3 +55,4 @@ "to-vfile": "^6.1.0",

"unist-builder": "^2.0.3",
"xo": "^0.32.1"
"unist-util-remove-position": "^3.0.0",
"unist-util-visit": "^2.0.0"
},

@@ -70,27 +65,3 @@ "nyc": {

},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/no-hex-escape": "off",
"unicorn/escape-case": "off",
"no-self-compare": "off",
"no-lonely-if": "off"
}
},
"gitHead": "e194fc1a61715549be10d56055ea4ad25533fcb1"
"gitHead": "6fc71ff94c671582b4185a98f87dcdb1d18c831b"
}

@@ -75,10 +75,10 @@ # remark-mdx

{type: 'text', value: 'Hello, '},
{type: 'mdxSpanExpression', value: 'data.to'}
{type: 'mdxTextExpression', value: 'data.to'}
]
},
{
type: 'mdxBlockElement',
type: 'mdxJsxFlowElement',
name: 'Body',
attributes: [],
children: [{type: 'mdxBlockExpression', value: 'message'}]
children: [{type: 'mdxFlowExpression', value: 'message'}]
},

@@ -89,3 +89,3 @@ {

{type: 'text', value: 'Best, '},
{type: 'mdxSpanExpression', value: 'data.from'}
{type: 'mdxTextExpression', value: 'data.from'}
]

@@ -165,5 +165,5 @@ }

[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://spectrum.chat/unified/remark
[chat]: https://github.com/mdx-js/mdx/discussions

@@ -170,0 +170,0 @@ [npm]: https://docs.npmjs.com/cli/install

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