Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/html-parser

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/html-parser - npm Package Compare versions

Comparing version 4.0.0-alpha.4 to 4.0.0-alpha.5

7

lib/create-tree.js
// @ts-nocheck TODO: Parse5(https://github.com/inikulin/parse5) supports to expose type definitions as submodules.
import { detectElementType, getEndCol, getEndLine, sliceFragment, uuid } from '@markuplint/parser-utils';
import { detectElementType, getEndCol, getEndLine, sliceFragment, tagParser, uuid } from '@markuplint/parser-utils';
import { parse, parseFragment } from 'parse5';
import parseRawTag from './parse-raw-tag.js';
const P5_OPTIONS = {

@@ -150,3 +149,3 @@ scriptingEnabled: false,

: rawHtml.slice(startOffset, endOffset ?? startOffset);
const tagTokens = parseRawTag(startTagRaw, startLine, startCol, startOffset, offsetOffset, offsetLine, offsetColumn);
const tagTokens = tagParser(startTagRaw, startLine, startCol, startOffset, offsetOffset, offsetLine, offsetColumn);
const tagName = tagTokens.tagName;

@@ -172,3 +171,3 @@ let endTag = null;

const endTagRaw = rawHtml.slice(startOffset, endOffset);
const endTagTokens = parseRawTag(endTagRaw, startLine, startCol, startOffset, offsetOffset, offsetLine, offsetColumn);
const endTagTokens = tagParser(endTagRaw, startLine, startCol, startOffset, offsetOffset, offsetLine, offsetColumn);
const endTagName = endTagTokens.tagName;

@@ -175,0 +174,0 @@ endTag = {

@@ -1,6 +0,4 @@

export { default as attrTokenizer } from './attr-tokenizer.js';
export { default as isDocumentFragment } from './is-document-fragment.js';
export { default as parseRawTag } from './parse-raw-tag.js';
export { isDocumentFragment } from './is-document-fragment.js';
export { getNamespace } from './get-namespace.js';
export { parse } from './parse.js';
export { createTree } from './create-tree.js';

@@ -1,6 +0,4 @@

export { default as attrTokenizer } from './attr-tokenizer.js';
export { default as isDocumentFragment } from './is-document-fragment.js';
export { default as parseRawTag } from './parse-raw-tag.js';
export { isDocumentFragment } from './is-document-fragment.js';
export { getNamespace } from './get-namespace.js';
export { parse } from './parse.js';
export { createTree } from './create-tree.js';

@@ -1,1 +0,1 @@

export default function isDocumentFragment(html: string): boolean;
export declare function isDocumentFragment(html: string): boolean;

@@ -1,3 +0,3 @@

export default function isDocumentFragment(html) {
return !/^\s*(<!doctype html(?:\s*.+)?>|<html[\s>])/im.test(html);
export function isDocumentFragment(html) {
return !/^\s*(?:<!doctype html(?:\s*(?:\S.*|[\t\v\f \u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))?>|<html[\s>])/im.test(html);
}

@@ -8,5 +8,3 @@ const UNDUPLICATED_CHAR = '\uFFFD';

const bodies = [];
const code = rawCode.replaceAll(
// eslint-disable-next-line no-control-regex
/(?<=<\/?)(?:head|body)(?=\u0009|\u000A|\u000C| |\/|>|\u0000)/gi, tag => {
const code = rawCode.replaceAll(/(?<=<\/?)(?:head|body)(?=[\0\t\n\f />])/gi, tag => {
const prefix = `x-${UNDUPLICATED_CHAR}`;

@@ -13,0 +11,0 @@ let name;

import { ignoreFrontMatter, flattenNodes } from '@markuplint/parser-utils';
import { createTree } from './create-tree.js';
import isDocumentFragment from './is-document-fragment.js';
import { isDocumentFragment } from './is-document-fragment.js';
import { isStartsHeadTagOrBodyTag, optimizeStartsHeadTagOrBodyTagResume, optimizeStartsHeadTagOrBodyTagSetup, } from './optimize-starts-head-or-body.js';

@@ -5,0 +5,0 @@ export const parse = (rawCode, options) => {

{
"name": "@markuplint/html-parser",
"version": "4.0.0-alpha.4",
"version": "4.0.0-alpha.5",
"description": "HTML parser for markuplint",

@@ -28,8 +28,8 @@ "repository": "git@github.com:markuplint/markuplint.git",

"dependencies": {
"@markuplint/ml-ast": "4.0.0-alpha.4",
"@markuplint/parser-utils": "4.0.0-alpha.4",
"@markuplint/ml-ast": "4.0.0-alpha.5",
"@markuplint/parser-utils": "4.0.0-alpha.5",
"parse5": "7.1.2",
"type-fest": "^4.5.0"
},
"gitHead": "991b3aef77fde42c79343ee8c807257a35c589d7"
"gitHead": "0c3e4690662edf1765bcc4b6411ec5507c1e2ea3"
}

Sorry, the diff of this file is not supported yet

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