File tree Expand file tree Collapse file tree 2 files changed +913
-776
lines changed Expand file tree Collapse file tree 2 files changed +913
-776
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ const UNSATISFIABLE_RULES = new Set([
3333] ) ;
3434const SUPPORTS_AUTOFIX = true ;
3535
36+ const BOM = "\uFEFF" ;
37+
3638/**
3739 * @type {Map<string, Block[]> }
3840 */
@@ -248,11 +250,12 @@ const languageToFileExtension = {
248250
249251/**
250252 * Extracts lintable code blocks from Markdown text.
251- * @param {string } text The text of the file.
253+ * @param {string } sourceText The text of the file.
252254 * @param {string } filename The filename of the file
253255 * @returns {Array<{ filename: string, text: string }> } Source code blocks to lint.
254256 */
255- function preprocess ( text , filename ) {
257+ function preprocess ( sourceText , filename ) {
258+ const text = sourceText . startsWith ( BOM ) ? sourceText . slice ( 1 ) : sourceText ;
256259 const ast = fromMarkdown ( text ) ;
257260 const blocks = [ ] ;
258261
You can’t perform that action at this time.
0 commit comments