Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

micromark-factory-mdx-expression

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-factory-mdx-expression - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

4

dev/index.d.ts

@@ -14,2 +14,3 @@ /**

* @param {boolean} [allowLazy=false]
* @param {number} [startColumn=0]
* @returns {State}

@@ -28,3 +29,4 @@ */

allowEmpty?: boolean | undefined,
allowLazy?: boolean | undefined
allowLazy?: boolean | undefined,
startColumn?: number | undefined
): State

@@ -31,0 +33,0 @@ export type Point = import('micromark-util-types').Point

@@ -14,2 +14,3 @@ /**

import {types} from 'micromark-util-symbol/types.js'
import {constants} from 'micromark-util-symbol/constants.js'
import {factorySpace} from 'micromark-factory-space'

@@ -33,2 +34,3 @@ import {positionFromEstree} from 'unist-util-position-from-estree'

* @param {boolean} [allowLazy=false]
* @param {number} [startColumn=0]
* @returns {State}

@@ -48,3 +50,4 @@ */

allowEmpty,
allowLazy
allowLazy,
startColumn
) {

@@ -58,2 +61,3 @@ const self = this

: 0
const prefixExpressionIndent = initialPrefix ? initialPrefix + 1 : 0
let balance = 1

@@ -99,5 +103,15 @@ /** @type {Point} */

effects.exit(types.lineEnding)
// Return atBreak
return initialPrefix
? factorySpace(effects, atBreak, types.linePrefix, initialPrefix + 1)
// `startColumn` is used by the JSX extensions that also wraps this
// factory.
// JSX can be indented arbitrarily, but expressions can’t exdent
// arbitrarily, due to that they might contain template strings
// (backticked strings).
// We’ll eat up to where that tag starts (`startColumn`), and a tab size.
/* c8 ignore next 3 */
const prefixTagIndent = startColumn
? startColumn + constants.tabSize - self.now().column
: 0
const indent = Math.max(prefixExpressionIndent, prefixTagIndent)
return indent
? factorySpace(effects, atBreak, types.linePrefix, indent)
: atBreak

@@ -104,0 +118,0 @@ }

@@ -14,2 +14,3 @@ /**

* @param {boolean} [allowLazy=false]
* @param {number} [startColumn=0]
* @returns {State}

@@ -28,3 +29,4 @@ */

allowEmpty?: boolean | undefined,
allowLazy?: boolean | undefined
allowLazy?: boolean | undefined,
startColumn?: number | undefined
): State

@@ -31,0 +33,0 @@ export type Point = import('micromark-util-types').Point

@@ -27,2 +27,3 @@ /**

* @param {boolean} [allowLazy=false]
* @param {number} [startColumn=0]
* @returns {State}

@@ -43,3 +44,4 @@ */

allowEmpty,
allowLazy
allowLazy,
startColumn
) {

@@ -54,2 +56,3 @@ const self = this

: 0
const prefixExpressionIndent = initialPrefix ? initialPrefix + 1 : 0
let balance = 1

@@ -94,6 +97,17 @@ /** @type {Point} */

effects.consume(code)
effects.exit('lineEnding') // Return atBreak
effects.exit('lineEnding') // `startColumn` is used by the JSX extensions that also wraps this
// factory.
// JSX can be indented arbitrarily, but expressions can’t exdent
// arbitrarily, due to that they might contain template strings
// (backticked strings).
// We’ll eat up to where that tag starts (`startColumn`), and a tab size.
return initialPrefix
? factorySpace(effects, atBreak, 'linePrefix', initialPrefix + 1)
/* c8 ignore next 3 */
const prefixTagIndent = startColumn
? startColumn + 4 - self.now().column
: 0
const indent = Math.max(prefixExpressionIndent, prefixTagIndent)
return indent
? factorySpace(effects, atBreak, 'linePrefix', indent)
: atBreak

@@ -100,0 +114,0 @@ }

{
"name": "micromark-factory-mdx-expression",
"version": "1.0.5",
"version": "1.0.6",
"description": "micromark factory to parse MDX expressions (found in JSX attributes, flow, text)",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -94,2 +94,4 @@ # micromark-factory-mdx-expression

expression
* `number` (`startColumn`, default: `0`) — Treat whitespace up to this number
and a tab size as indent

@@ -96,0 +98,0 @@ ###### Returns

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