§ Quick Take

import { strict as assert } from "assert";
import { Linter } from "emlint";
const linter = new Linter();

// Correct "not" type Outlook conditional would be:
// <!--[if !mso]><!-->
//   <span class="foo">z</span>
// <!--<![endif]-->

// We have a "not" type opening but "only" type
// closing:
const messages = linter.verify(
  `<!--[if !mso]><!-->
  <span class="foo">z</span>
<![endif]-->`,
  {
    rules: {
      all: 2,
    },
  }
);

assert.deepEqual(messages, [
  {
    line: 3,
    column: 1,
    severity: 2,
    ruleId: "comment-mismatching-pair",
    message: `Add "<!--".`,
    idxFrom: 49,
    idxTo: 61,
    fix: {
      ranges: [[49, 49, "<!--"]],
    },
    keepSeparateWhenFixing: true,
  },
]);

§ Notice

EMLint is currently being developed. Please come back later.

§ Changelog

See it in the monorepo opens in a new tab, on GitHub.

§ Contributing

To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.

§ Licence

MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

📦 codsen-parser 0.10.11
Parser aiming at broken or mixed code, especially HTML & CSS
📦 codsen-tokenizer 5.5.5
HTML and CSS lexer aimed at code with fatal errors, accepts mixed coding languages
📦 detergent 7.0.14
Extracts, cleans and encodes text
📦 html-crush 4.1.8
Minifies HTML/CSS: valid or broken, pure or mixed with other languages
📦 email-comb 5.0.14
Remove unused CSS from email templates
📦 string-strip-html 8.2.11
Strips HTML tags from strings. No parser, accepts mixed sources
📦 json-variables 10.0.14
Resolves custom-marked, cross-referenced paths in parsed JSON