JSPM

  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q71176F
  • License MIT

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

Package Exports

  • codsen-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (codsen-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

codsen-parser

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

Install

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 and examples.

Contributing

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

Licence

MIT License

Copyright (c) 2010-2021 Roy Revelt and other contributors

ok codsen star