codsen-parser
TypeScript icon, indicating that this package has built-in type declarations

0.14.24 • Public • Published

codsen-parser

Parser aiming at broken or mixed code, especially HTML & CSS

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM.

npm i codsen-parser

Quick Take

import { strict as assert } from "assert";

import { cparser } from "codsen-parser";

assert.deepEqual(cparser("<br>z</a>"), [
  {
    type: "tag",
    kind: "inline",
    tagName: "br",
    tagNameStartsAt: 1,
    tagNameEndsAt: 3,
    closing: false,
    void: true,
    pureHTML: true,
    recognised: true,
    start: 0,
    end: 4,
    value: "<br>",
    attribs: [],
    children: [],
  },
  {
    type: "text",
    start: 4,
    end: 5,
    value: "z",
  },
  {
    type: "tag",
    kind: "inline",
    tagName: "a",
    tagNameStartsAt: 7,
    tagNameEndsAt: 8,
    closing: true,
    void: false,
    pureHTML: true,
    recognised: true,
    start: 5,
    end: 9,
    value: "</a>",
    attribs: [],
    children: [],
  },
]);

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2024 Roy Revelt and other contributors.

ok codsen star

Dependencies (6)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i codsen-parser

    Weekly Downloads

    19

    Version

    0.14.24

    License

    MIT

    Unpacked Size

    109 kB

    Total Files

    7

    Last publish

    Collaborators

    • royston