mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Remove UTF-8 byte order marker from file/string input.
This commit is contained in:
parent
dcf0462c22
commit
f077e4c393
4 changed files with 12 additions and 1 deletions
|
@ -184,7 +184,7 @@
|
||||||
"max-lines": "off",
|
"max-lines": "off",
|
||||||
"max-nested-callbacks": "error",
|
"max-nested-callbacks": "error",
|
||||||
"max-params": ["error", 6],
|
"max-params": ["error", 6],
|
||||||
"max-statements": ["error", 26],
|
"max-statements": ["error", 28],
|
||||||
"max-statements-per-line": "error",
|
"max-statements-per-line": "error",
|
||||||
"multiline-ternary": "off",
|
"multiline-ternary": "off",
|
||||||
"new-cap": "error",
|
"new-cap": "error",
|
||||||
|
|
|
@ -83,6 +83,10 @@ function uniqueFilterForSortedErrors(value, index, array) {
|
||||||
|
|
||||||
// Lints a single string
|
// Lints a single string
|
||||||
function lintContent(content, config, frontMatter, resultVersion) {
|
function lintContent(content, config, frontMatter, resultVersion) {
|
||||||
|
// Remove UTF-8 byte order marker (if present)
|
||||||
|
if (content.charCodeAt(0) === 0xfeff) {
|
||||||
|
content = content.slice(1);
|
||||||
|
}
|
||||||
// Remove front matter (if present at beginning of content)
|
// Remove front matter (if present at beginning of content)
|
||||||
var frontMatterLines = 0;
|
var frontMatterLines = 0;
|
||||||
if (frontMatter) {
|
if (frontMatter) {
|
||||||
|
|
4
test/byte-order-marker-utf8.json
Normal file
4
test/byte-order-marker-utf8.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"MD041": true
|
||||||
|
}
|
3
test/byte-order-marker-utf8.md
Normal file
3
test/byte-order-marker-utf8.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Header
|
||||||
|
|
||||||
|
Text
|
Loading…
Add table
Add a link
Reference in a new issue