Socket
Socket
Sign inDemoInstall

hast-util-to-text

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hast-util-to-text - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

4

lib/index.d.ts

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

* Tree to turn into text.
* @param {Options} [options]
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).

@@ -35,3 +35,3 @@ * @returns {string}

*/
export function toText(tree: Nodes, options?: Options | undefined): string;
export function toText(tree: Nodes, options?: Readonly<Options> | null | undefined): string;
export type Comment = import('hast').Comment;

@@ -38,0 +38,0 @@ export type Element = import('hast').Element;

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

'legend', // Flow content
'li', // Lists (as `display: list-item`)
'listing', // Flow content (legacy)

@@ -151,3 +152,3 @@ 'main', // Flow content

* Tree to turn into text.
* @param {Options} [options]
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).

@@ -157,7 +158,8 @@ * @returns {string}

*/
export function toText(tree, options = {}) {
export function toText(tree, options) {
const options_ = options || {}
const children = 'children' in tree ? tree.children : []
const block = blockOrCaption(tree)
const whitespace = inferWhitespace(tree, {
whitespace: options.whitespace || 'normal',
whitespace: options_.whitespace || 'normal',
breakBefore: false,

@@ -275,2 +277,3 @@ breakAfter: false

console.trace('xxx')
return []

@@ -580,3 +583,3 @@ }

if (node.type === 'element') {
const props = node.properties || {}
const properties = node.properties || {}
switch (node.tagName) {

@@ -594,3 +597,3 @@ case 'listing':

case 'pre': {
return props.wrap ? 'pre-wrap' : 'pre'
return properties.wrap ? 'pre-wrap' : 'pre'
}

@@ -600,3 +603,3 @@

case 'th': {
return props.noWrap ? 'nowrap' : info.whitespace
return properties.noWrap ? 'nowrap' : info.whitespace
}

@@ -603,0 +606,0 @@

{
"name": "hast-util-to-text",
"version": "4.0.0",
"version": "4.0.1",
"description": "hast utility to get the plain-text value of a node according to the `innerText` algorithm",

@@ -44,4 +44,4 @@ "license": "MIT",

"@types/node": "^20.0.0",
"c8": "^8.0.0",
"hastscript": "^8.0.0",
"c8": "^9.0.0",
"hastscript": "^9.0.0",
"prettier": "^3.0.0",

@@ -52,4 +52,3 @@ "remark-cli": "^11.0.0",

"typescript": "^5.0.0",
"unist-builder": "^4.0.0",
"xo": "^0.55.0"
"xo": "^0.58.0"
},

@@ -56,0 +55,0 @@ "scripts": {

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