markedjs/html-differ hiện có 35 sao trên GitHub, viết chủ yếu bằng JavaScript. Сompares two HTML
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Two respective attributes class are considered to be equivalent if they refer to the same groups of CSS styles.
For example, the following two code samples will be considered to be equivalent:
<span class="ab bc cd">Text</span>
<span class=" cd ab bc bc">Text</span>
CAUTION! html-differ does not check the validity of HTML, but compares them using the above shown criteria and specified options (see the list of possible options).
Install
$ npm install @markedjs/html-differ
API
HtmlDiffer
import { HtmlDiffer } from '@markedjs/html-differ';
const htmlDiffer = new HtmlDiffer(options);
where options is an object.
Options
ignoreAttributes: [Array]
Sets what kind of respective attributes' content will be ignored during the comparison (default: []).
Example: ['id', 'for']
The following two code samples will be considered to be equivalent:
Sets what kind of respective attributes' content will be compared as JSON objects, but not as strings (default: []).
In cases when the value of the attribute is an invalid JSON or can not be wrapped into a function, it will be compared as undefined.
Example: [{ name: 'data', isFunction: false }, { name: 'onclick', isFunction: true }]
The following two code samples will be considered to be equivalent:
<div data='{"bla":{"first":"ololo","second":"trololo"}}'></div>
<span onclick='return {"aaa":"bbb","bbb":"aaa"}'></span>
<button data='REALLY BAD JSON'></button>
<button onclick='REALLY BAD FUNCTION'></button>
$ html-differ --help
Compares two HTML
Usage:
html-differ [OPTIONS] [ARGS]
Options:
-h, --help : Help
-v, --version : Shows the version number
--config=CONFIG : Path to a configuration JSON file
--bem : Uses predefined options for BEM (deprecated)
-p PRESET, --preset=PRESET : Name of a preset
--chars-around-diff=CHARSAROUNDDIFF : The number of characters around the diff (default: 40)
Arguments:
PATH1 : Path to the 1-st HTML file (required)
PATH2 : Path to the 2-nd HTML file (required)
For example, the following two code samples will be considered to be equivalent:
<div id="{{[a-z]*\s\d+}}">
<div id="text 12345">
Syntax
Masks in html-differ have the following syntax:
{{RegExp}}
where:
{{ – opening identifier of the mask.
RegExp – regular expression for matching with the corresponding value in another HTML. The syntax is similar to regular expressions in JavaScript written in a literal notation.
}} – closing identifier of the mask.
Screening
The rules of screening of symbols are similar to the rules which are used in regular expressions in JavaScript written in a literal notation.
For example, the following two code samples will be considered to be equivalent:
<div id="{{\d\.\d}}">
<div id="1.1">
If you want to use {{ or }} inside a mask, you should screen both curly braces, i.e. \{\} or \}\}.
For example, the following two code samples will be considered to be equivalent:
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/markedjs/html-differ là nguồn chính thức.
markedjs/html-differ có bao nhiêu sao?
markedjs/html-differ có 35 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/markedjs/html-differ. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
markedjs/html-differ có phải mã nguồn mở không?
Có — markedjs/html-differ phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/markedjs/html-differ.
markedjs/html-differ có trang demo không?
Dự án có trang chủ ở https://www.npmjs.com/package/@markedjs/html-differ. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
markedjs/html-differ là gì?
markedjs/html-differ (markedjs/html-differ) là dự án JavaScript trên GitHub. Theo mô tả gốc: Сompares two HTML
Đọc đầy đủ README ở tab phía trên.
html-differ có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về html-differ.