Skip to content

Issues with HTML entities parsing #15

Closed
@danielepolencic

Description

@danielepolencic

Initial checklist

Affected packages and versions

test with 7.2.0 and 6.0.2

Link to runnable example

No response

Steps to reproduce

import { raw } from "hast-util-raw"

const root = raw({
  type: 'root',
  children: [
    {
      type: 'element',
      tagName: 'span',
      children: [
        {
          type: 'raw',
          value: '/api/v1/&lt;resource-type-name&gt;/&lt;resource-name&gt;', <-- this
        },
      ],
    },
  ],
})

console.log(root)

// {
//   "type": "root",
//   "children": [
//     {
//       "type": "element",
//       "tagName": "span",
//       "properties": {},
//       "children": [
//         {
//           "type": "text",
//           "value": "/api/v1/<resource-type-name>/<resource-name" <-- this
//         }
//       ]
//     }
//   ],
//   "data": {
//     "quirksMode": false
//   }
// }

Expected behavior

The last > is retained.

Actual behavior

The last > is removed.

Runtime

Node v14

Package manager

npm v7

OS

macOS

Build and bundle tools

Other (please specify in steps to reproduce)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions