pickier-vscode 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/extension.js +316 -84
  2. package/package.json +1 -1
package/dist/extension.js CHANGED
@@ -5871,13 +5871,18 @@ function detectQuoteIssues(line, preferred) {
5871
5871
  }
5872
5872
  return indices;
5873
5873
  }
5874
- function hasIndentIssue(leading, indentSize, indentStyle = "spaces") {
5874
+ function hasIndentIssue(leading, indentSize, indentStyle = "spaces", lineContent) {
5875
5875
  if (indentStyle === "tabs") {
5876
5876
  return /[^\t]/.test(leading);
5877
5877
  }
5878
5878
  if (/\t/.test(leading))
5879
5879
  return true;
5880
5880
  const spaces = leading.length;
5881
+ if (lineContent && spaces % indentSize === 1) {
5882
+ const trimmed = lineContent.trimStart();
5883
+ if (trimmed.startsWith("* ") || trimmed.startsWith("*/") || trimmed === "*")
5884
+ return false;
5885
+ }
5881
5886
  return spaces % indentSize !== 0;
5882
5887
  }
5883
5888
  function maskStrings(input) {
@@ -17086,38 +17091,41 @@ var init_blanks_around_fences = __esm(() => {
17086
17091
  check: (text, ctx) => {
17087
17092
  const issues = [];
17088
17093
  const lines = text.split(/\r?\n/);
17094
+ let inFence = false;
17089
17095
  for (let i = 0;i < lines.length; i++) {
17090
17096
  const line = lines[i];
17091
- const prevLine = i > 0 ? lines[i - 1] : "";
17092
- const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17093
- const isFence = /^(`{3,}|~{3,})/.test(line);
17097
+ const isFence = /^(`{3,}|~{3,})/.test(line.trim());
17094
17098
  if (isFence) {
17095
- let isOpening = true;
17096
- for (let j = i - 1;j >= 0; j--) {
17097
- if (/^(`{3,}|~{3,})/.test(lines[j])) {
17098
- isOpening = false;
17099
- break;
17099
+ if (!inFence) {
17100
+ const prevLine = i > 0 ? lines[i - 1] : "";
17101
+ if (i > 0 && prevLine.trim().length > 0) {
17102
+ if (!/^:::/.test(prevLine.trim())) {
17103
+ issues.push({
17104
+ filePath: ctx.filePath,
17105
+ line: i + 1,
17106
+ column: 1,
17107
+ ruleId: "markdown/blanks-around-fences",
17108
+ message: "Fenced code blocks should be surrounded by blank lines",
17109
+ severity: "error"
17110
+ });
17111
+ }
17100
17112
  }
17101
- }
17102
- if (isOpening && i > 0 && prevLine.trim().length > 0) {
17103
- issues.push({
17104
- filePath: ctx.filePath,
17105
- line: i + 1,
17106
- column: 1,
17107
- ruleId: "markdown/blanks-around-fences",
17108
- message: "Fenced code blocks should be surrounded by blank lines",
17109
- severity: "error"
17110
- });
17111
- }
17112
- if (!isOpening && i + 1 < lines.length && nextLine.trim().length > 0) {
17113
- issues.push({
17114
- filePath: ctx.filePath,
17115
- line: i + 1,
17116
- column: 1,
17117
- ruleId: "markdown/blanks-around-fences",
17118
- message: "Fenced code blocks should be surrounded by blank lines",
17119
- severity: "error"
17120
- });
17113
+ inFence = true;
17114
+ } else {
17115
+ const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17116
+ if (i + 1 < lines.length && nextLine.trim().length > 0) {
17117
+ if (!/^:::/.test(nextLine.trim())) {
17118
+ issues.push({
17119
+ filePath: ctx.filePath,
17120
+ line: i + 1,
17121
+ column: 1,
17122
+ ruleId: "markdown/blanks-around-fences",
17123
+ message: "Fenced code blocks should be surrounded by blank lines",
17124
+ severity: "error"
17125
+ });
17126
+ }
17127
+ }
17128
+ inFence = false;
17121
17129
  }
17122
17130
  }
17123
17131
  }
@@ -17130,10 +17138,10 @@ var init_blanks_around_fences = __esm(() => {
17130
17138
  for (let i = 0;i < lines.length; i++) {
17131
17139
  const line = lines[i];
17132
17140
  const prevLine = i > 0 ? lines[i - 1] : "";
17133
- const isFence = /^(`{3,}|~{3,})/.test(line);
17141
+ const isFence = /^(`{3,}|~{3,})/.test(line.trim());
17134
17142
  if (isFence) {
17135
17143
  if (!inFence) {
17136
- if (i > 0 && prevLine.trim().length > 0 && result.length > 0) {
17144
+ if (i > 0 && prevLine.trim().length > 0 && !/^:::/.test(prevLine.trim()) && result.length > 0) {
17137
17145
  result.push("");
17138
17146
  }
17139
17147
  inFence = true;
@@ -17144,7 +17152,7 @@ var init_blanks_around_fences = __esm(() => {
17144
17152
  result.push(line);
17145
17153
  if (isFence && !inFence && i + 1 < lines.length) {
17146
17154
  const nextLine = lines[i + 1];
17147
- if (nextLine.trim().length > 0) {
17155
+ if (nextLine.trim().length > 0 && !/^:::/.test(nextLine.trim())) {
17148
17156
  result.push("");
17149
17157
  }
17150
17158
  }
@@ -17280,14 +17288,22 @@ var init_blanks_around_lists = __esm(() => {
17280
17288
  const issues = [];
17281
17289
  const lines = text.split(/\r?\n/);
17282
17290
  let inList = false;
17283
- let listStartLine = -1;
17291
+ let inFence = false;
17284
17292
  for (let i = 0;i < lines.length; i++) {
17285
17293
  const line = lines[i];
17286
17294
  const prevLine = i > 0 ? lines[i - 1] : "";
17295
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17296
+ inFence = !inFence;
17297
+ if (inList)
17298
+ inList = false;
17299
+ continue;
17300
+ }
17301
+ if (inFence)
17302
+ continue;
17287
17303
  const isListItem = /^(\s*)([*\-+]|\d+\.)\s+/.test(line);
17304
+ const isListContinuation = inList && !isListItem && line.trim().length > 0 && /^\s+/.test(line);
17288
17305
  if (isListItem && !inList) {
17289
17306
  inList = true;
17290
- listStartLine = i;
17291
17307
  if (i > 0 && prevLine.trim().length > 0) {
17292
17308
  issues.push({
17293
17309
  filePath: ctx.filePath,
@@ -17298,7 +17314,7 @@ var init_blanks_around_lists = __esm(() => {
17298
17314
  severity: "error"
17299
17315
  });
17300
17316
  }
17301
- } else if (!isListItem && inList && line.trim().length > 0) {
17317
+ } else if (!isListItem && !isListContinuation && inList && line.trim().length > 0) {
17302
17318
  inList = false;
17303
17319
  const prevLineIsListItem = /^(\s*)([*\-+]|\d+\.)\s+/.test(prevLine);
17304
17320
  if (prevLineIsListItem) {
@@ -17359,15 +17375,21 @@ var init_blanks_around_tables = __esm(() => {
17359
17375
  const issues = [];
17360
17376
  const lines = text.split(/\r?\n/);
17361
17377
  let inTable = false;
17362
- let tableStartLine = -1;
17378
+ let inFence = false;
17363
17379
  for (let i = 0;i < lines.length; i++) {
17364
17380
  const line = lines[i];
17365
17381
  const prevLine = i > 0 ? lines[i - 1] : "";
17366
- const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
17382
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17383
+ inFence = !inFence;
17384
+ if (inTable)
17385
+ inTable = false;
17386
+ continue;
17387
+ }
17388
+ if (inFence)
17389
+ continue;
17367
17390
  const isTableLine = /\|/.test(line) && line.trim().length > 0;
17368
17391
  if (isTableLine && !inTable) {
17369
17392
  inTable = true;
17370
- tableStartLine = i;
17371
17393
  if (i > 0 && prevLine.trim().length > 0) {
17372
17394
  issues.push({
17373
17395
  filePath: ctx.filePath,
@@ -17849,8 +17871,15 @@ var init_heading_increment = __esm(() => {
17849
17871
  const issues = [];
17850
17872
  const lines = text.split(/\r?\n/);
17851
17873
  let previousLevel = 0;
17874
+ let inFence = false;
17852
17875
  for (let i = 0;i < lines.length; i++) {
17853
17876
  const line = lines[i];
17877
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17878
+ inFence = !inFence;
17879
+ continue;
17880
+ }
17881
+ if (inFence)
17882
+ continue;
17854
17883
  const atxMatch = line.match(/^(#{1,6})\s/);
17855
17884
  if (atxMatch) {
17856
17885
  const level = atxMatch[1].length;
@@ -17882,8 +17911,15 @@ var init_heading_start_left = __esm(() => {
17882
17911
  check: (text, ctx) => {
17883
17912
  const issues = [];
17884
17913
  const lines = text.split(/\r?\n/);
17914
+ let inFence = false;
17885
17915
  for (let i = 0;i < lines.length; i++) {
17886
17916
  const line = lines[i];
17917
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
17918
+ inFence = !inFence;
17919
+ continue;
17920
+ }
17921
+ if (inFence)
17922
+ continue;
17887
17923
  const match = line.match(/^(\s+)(#{1,6}\s)/);
17888
17924
  if (match) {
17889
17925
  issues.push({
@@ -18178,8 +18214,24 @@ var init_link_image_style = __esm(() => {
18178
18214
  const options = ctx.options || {};
18179
18215
  const style = options.style || "consistent";
18180
18216
  let detectedStyle = null;
18217
+ let inFence = false;
18218
+ let inHtmlComment = false;
18181
18219
  for (let i = 0;i < lines.length; i++) {
18182
18220
  const line = lines[i];
18221
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18222
+ inFence = !inFence;
18223
+ continue;
18224
+ }
18225
+ if (inFence)
18226
+ continue;
18227
+ if (line.includes("<!--"))
18228
+ inHtmlComment = true;
18229
+ if (line.includes("-->")) {
18230
+ inHtmlComment = false;
18231
+ continue;
18232
+ }
18233
+ if (inHtmlComment)
18234
+ continue;
18183
18235
  if (line.match(/^\[([^\]]+)\]:\s*\S+/)) {
18184
18236
  continue;
18185
18237
  }
@@ -18396,19 +18448,34 @@ var init_no_bare_urls = __esm(() => {
18396
18448
  check: (text, ctx) => {
18397
18449
  const issues = [];
18398
18450
  const lines = text.split(/\r?\n/);
18451
+ let inFence = false;
18452
+ let inHtmlComment = false;
18399
18453
  for (let i = 0;i < lines.length; i++) {
18400
18454
  const line = lines[i];
18401
- if (line.trim().startsWith("```") || line.trim().startsWith("~~~")) {
18455
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18456
+ inFence = !inFence;
18457
+ continue;
18458
+ }
18459
+ if (inFence)
18460
+ continue;
18461
+ if (line.includes("<!--"))
18462
+ inHtmlComment = true;
18463
+ if (line.includes("-->")) {
18464
+ inHtmlComment = false;
18402
18465
  continue;
18403
18466
  }
18404
- const urlPattern = /(?<![<`(])https?:\/\/[^\s<>`)\]]+(?![>\])`])/g;
18405
- const matches = line.matchAll(urlPattern);
18467
+ if (inHtmlComment)
18468
+ continue;
18469
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
18470
+ continue;
18471
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
18472
+ const urlPattern = /(?<![<(="'])https?:\/\/[^\s<>`)\]"']+(?![>\])"'])/g;
18473
+ const matches = stripped.matchAll(urlPattern);
18406
18474
  for (const match of matches) {
18407
- const column = match.index + 1;
18408
18475
  issues.push({
18409
18476
  filePath: ctx.filePath,
18410
18477
  line: i + 1,
18411
- column,
18478
+ column: match.index + 1,
18412
18479
  ruleId: "markdown/no-bare-urls",
18413
18480
  message: "Bare URL used. Wrap in angle brackets: <url>",
18414
18481
  severity: "error"
@@ -18419,11 +18486,26 @@ var init_no_bare_urls = __esm(() => {
18419
18486
  },
18420
18487
  fix: (text) => {
18421
18488
  const lines = text.split(/\r?\n/);
18489
+ let inFence = false;
18490
+ let inHtmlComment = false;
18422
18491
  const fixedLines = lines.map((line) => {
18423
- if (line.trim().startsWith("```") || line.trim().startsWith("~~~")) {
18492
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18493
+ inFence = !inFence;
18424
18494
  return line;
18425
18495
  }
18426
- return line.replace(/(?<![<`(])https?:\/\/[^\s<>`)\]]+(?![>\])`])/g, "<$&>");
18496
+ if (inFence)
18497
+ return line;
18498
+ if (line.includes("<!--"))
18499
+ inHtmlComment = true;
18500
+ if (line.includes("-->")) {
18501
+ inHtmlComment = false;
18502
+ return line;
18503
+ }
18504
+ if (inHtmlComment)
18505
+ return line;
18506
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
18507
+ return line;
18508
+ return line.replace(/(?<![<(="'])https?:\/\/[^\s<>`)\]"']+(?![>\])"'])/g, "<$&>");
18427
18509
  });
18428
18510
  return fixedLines.join(`
18429
18511
  `);
@@ -18479,8 +18561,15 @@ var init_no_duplicate_heading = __esm(() => {
18479
18561
  const issues = [];
18480
18562
  const lines = text.split(/\r?\n/);
18481
18563
  const headings = new Map;
18564
+ let inFence = false;
18482
18565
  for (let i = 0;i < lines.length; i++) {
18483
18566
  const line = lines[i];
18567
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18568
+ inFence = !inFence;
18569
+ continue;
18570
+ }
18571
+ if (inFence)
18572
+ continue;
18484
18573
  const atxMatch = line.match(/^#{1,6}\s+(.+?)(?:\s*#+\s*)?$/);
18485
18574
  if (atxMatch) {
18486
18575
  const content = atxMatch[1].trim();
@@ -18529,10 +18618,17 @@ var init_no_emphasis_as_heading = __esm(() => {
18529
18618
  check: (text, ctx) => {
18530
18619
  const issues = [];
18531
18620
  const lines = text.split(/\r?\n/);
18621
+ let inFence = false;
18532
18622
  for (let i = 0;i < lines.length; i++) {
18533
18623
  const line = lines[i];
18534
18624
  const prevLine = i > 0 ? lines[i - 1] : "";
18535
18625
  const nextLine = i + 1 < lines.length ? lines[i + 1] : "";
18626
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18627
+ inFence = !inFence;
18628
+ continue;
18629
+ }
18630
+ if (inFence)
18631
+ continue;
18536
18632
  const isBoldLine = /^\*\*[^*]+\*\*\s*$/.test(line) || /^__[^_]+__\s*$/.test(line);
18537
18633
  const isItalicLine = /^\*[^*]+\*\s*$/.test(line) || /^_[^_]+_\s*$/.test(line);
18538
18634
  const isStandalone = prevLine.trim().length === 0 && nextLine.trim().length === 0;
@@ -18638,9 +18734,17 @@ var init_no_inline_html = __esm(() => {
18638
18734
  const lines = text.split(/\r?\n/);
18639
18735
  const options = ctx.options || {};
18640
18736
  const allowedElements = options.allowed_elements || [];
18737
+ let inFence = false;
18641
18738
  for (let i = 0;i < lines.length; i++) {
18642
18739
  const line = lines[i];
18643
- const matches = line.matchAll(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi);
18740
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
18741
+ inFence = !inFence;
18742
+ continue;
18743
+ }
18744
+ if (inFence)
18745
+ continue;
18746
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
18747
+ const matches = stripped.matchAll(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi);
18644
18748
  for (const match of matches) {
18645
18749
  const tagName = match[1].toLowerCase();
18646
18750
  if (!allowedElements.includes(tagName)) {
@@ -18956,27 +19060,54 @@ var init_no_space_in_code = __esm(() => {
18956
19060
  check: (text, ctx) => {
18957
19061
  const issues = [];
18958
19062
  const lines = text.split(/\r?\n/);
19063
+ let inFence = false;
18959
19064
  for (let i = 0;i < lines.length; i++) {
18960
19065
  const line = lines[i];
18961
- const matches = line.matchAll(/(`+)\s+([^`]+?)\s+\1/g);
18962
- for (const match of matches) {
18963
- const column = match.index + 1;
18964
- issues.push({
18965
- filePath: ctx.filePath,
18966
- line: i + 1,
18967
- column,
18968
- ruleId: "markdown/no-space-in-code",
18969
- message: "Spaces inside code span elements",
18970
- severity: "error"
18971
- });
19066
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19067
+ inFence = !inFence;
19068
+ continue;
19069
+ }
19070
+ if (inFence)
19071
+ continue;
19072
+ const codeSpanPattern = /(`+)([\s\S]*?)\1/g;
19073
+ for (const match of line.matchAll(codeSpanPattern)) {
19074
+ const content = match[2];
19075
+ if (content.startsWith(" ") && content.endsWith(" ") && content.trim().length > 0) {
19076
+ issues.push({
19077
+ filePath: ctx.filePath,
19078
+ line: i + 1,
19079
+ column: match.index + 1,
19080
+ ruleId: "markdown/no-space-in-code",
19081
+ message: "Spaces inside code span elements",
19082
+ severity: "error"
19083
+ });
19084
+ }
18972
19085
  }
18973
19086
  }
18974
19087
  return issues;
18975
19088
  },
18976
19089
  fix: (text) => {
18977
- return text.replace(/(`+)\s+([^`]+?)\s+\1/g, (match, backticks, content) => {
18978
- return `${backticks}${content.trim()}${backticks}`;
18979
- });
19090
+ const lines = text.split(/\r?\n/);
19091
+ let inFence = false;
19092
+ const result = [];
19093
+ for (const line of lines) {
19094
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19095
+ inFence = !inFence;
19096
+ result.push(line);
19097
+ continue;
19098
+ }
19099
+ if (inFence) {
19100
+ result.push(line);
19101
+ continue;
19102
+ }
19103
+ result.push(line.replace(/(`+)([\s\S]*?)\1/g, (match, backticks, content) => {
19104
+ if (content.startsWith(" ") && content.endsWith(" ") && content.trim().length > 0)
19105
+ return `${backticks}${content.trim()}${backticks}`;
19106
+ return match;
19107
+ }));
19108
+ }
19109
+ return result.join(`
19110
+ `);
18980
19111
  }
18981
19112
  };
18982
19113
  });
@@ -18991,20 +19122,28 @@ var init_no_space_in_emphasis = __esm(() => {
18991
19122
  check: (text, ctx) => {
18992
19123
  const issues = [];
18993
19124
  const lines = text.split(/\r?\n/);
19125
+ let inFence = false;
18994
19126
  for (let i = 0;i < lines.length; i++) {
18995
19127
  const line = lines[i];
19128
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19129
+ inFence = !inFence;
19130
+ continue;
19131
+ }
19132
+ if (inFence)
19133
+ continue;
19134
+ const stripped = line.replace(/`[^`]+`/g, (m) => "\x01".repeat(m.length));
18996
19135
  const patterns = [
18997
- /(\*\*|\*|__?)\s+/g,
18998
- /\s+(\*\*|\*|__?)/g
19136
+ /\*\*\s+[^*]+?\*\*/g,
19137
+ /\*\*[^*]+?\s+\*\*/g,
19138
+ /__\s+[^_]+?__/g,
19139
+ /__[^_]+?\s+__/g
18999
19140
  ];
19000
19141
  for (const pattern of patterns) {
19001
- const matches = line.matchAll(pattern);
19002
- for (const match of matches) {
19003
- const column = match.index + 1;
19142
+ for (const match of stripped.matchAll(pattern)) {
19004
19143
  issues.push({
19005
19144
  filePath: ctx.filePath,
19006
19145
  line: i + 1,
19007
- column,
19146
+ column: match.index + 1,
19008
19147
  ruleId: "markdown/no-space-in-emphasis",
19009
19148
  message: "Spaces inside emphasis markers",
19010
19149
  severity: "error"
@@ -19015,9 +19154,28 @@ var init_no_space_in_emphasis = __esm(() => {
19015
19154
  return issues;
19016
19155
  },
19017
19156
  fix: (text) => {
19018
- let fixed = text.replace(/(\*\*|\*|__?)\s+/g, "$1");
19019
- fixed = fixed.replace(/\s+(\*\*|\*|__?)/g, "$1");
19020
- return fixed;
19157
+ const lines = text.split(/\r?\n/);
19158
+ let inFence = false;
19159
+ const result = [];
19160
+ for (const line of lines) {
19161
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19162
+ inFence = !inFence;
19163
+ result.push(line);
19164
+ continue;
19165
+ }
19166
+ if (inFence) {
19167
+ result.push(line);
19168
+ continue;
19169
+ }
19170
+ let fixed = line;
19171
+ fixed = fixed.replace(/\*\*\s+([^*]+?)\*\*/g, "**$1**");
19172
+ fixed = fixed.replace(/\*\*([^*]+?)\s+\*\*/g, "**$1**");
19173
+ fixed = fixed.replace(/__\s+([^_]+?)__/g, "__$1__");
19174
+ fixed = fixed.replace(/__([^_]+?)\s+__/g, "__$1__");
19175
+ result.push(fixed);
19176
+ }
19177
+ return result.join(`
19178
+ `);
19021
19179
  }
19022
19180
  };
19023
19181
  });
@@ -19321,20 +19479,37 @@ var init_reference_links_images = __esm(() => {
19321
19479
  definitions.add(defMatch[1].toLowerCase());
19322
19480
  }
19323
19481
  }
19482
+ let inFence = false;
19483
+ let inHtmlComment = false;
19324
19484
  for (let i = 0;i < lines.length; i++) {
19325
19485
  const line = lines[i];
19326
- const linkMatches = line.matchAll(/\[([^\]]+)\](?:\[([^\]]+)\])?(?!\()/g);
19486
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19487
+ inFence = !inFence;
19488
+ continue;
19489
+ }
19490
+ if (inFence)
19491
+ continue;
19492
+ if (line.includes("<!--"))
19493
+ inHtmlComment = true;
19494
+ if (line.includes("-->")) {
19495
+ inHtmlComment = false;
19496
+ continue;
19497
+ }
19498
+ if (inHtmlComment)
19499
+ continue;
19500
+ if (/^\[([^\]]+)\]:\s*\S+/.test(line))
19501
+ continue;
19502
+ const stripped = line.replace(/`[^`]+`/g, (m) => " ".repeat(m.length));
19503
+ const linkMatches = stripped.matchAll(/\[([^\]]+)\](?:\[([^\]]+)\])?(?!\()/g);
19327
19504
  for (const match of linkMatches) {
19328
19505
  const label = (match[2] || match[1]).toLowerCase();
19329
- if (line.match(/^\[([^\]]+)\]:\s*\S+/)) {
19506
+ if (/^[xX ]$/.test(label))
19330
19507
  continue;
19331
- }
19332
19508
  if (!definitions.has(label)) {
19333
- const column = match.index + 1;
19334
19509
  issues.push({
19335
19510
  filePath: ctx.filePath,
19336
19511
  line: i + 1,
19337
- column,
19512
+ column: match.index + 1,
19338
19513
  ruleId: "markdown/reference-links-images",
19339
19514
  message: `Reference link '[${label}]' is not defined`,
19340
19515
  severity: "error"
@@ -19677,8 +19852,15 @@ var init_table_pipe_style = __esm(() => {
19677
19852
  const lines = text.split(/\r?\n/);
19678
19853
  const options = ctx.options || {};
19679
19854
  const style = options.style || "leading_and_trailing";
19855
+ let inFence = false;
19680
19856
  for (let i = 0;i < lines.length; i++) {
19681
19857
  const line = lines[i];
19858
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19859
+ inFence = !inFence;
19860
+ continue;
19861
+ }
19862
+ if (inFence)
19863
+ continue;
19682
19864
  if (/\|/.test(line) && line.trim().length > 0) {
19683
19865
  const hasLeading = line.trim().startsWith("|");
19684
19866
  const hasTrailing = line.trim().endsWith("|");
@@ -19746,8 +19928,15 @@ var init_ul_indent = __esm(() => {
19746
19928
  const lines = text.split(/\r?\n/);
19747
19929
  const options = ctx.options || {};
19748
19930
  const expectedIndent = options.indent || 2;
19931
+ let inFence = false;
19749
19932
  for (let i = 0;i < lines.length; i++) {
19750
19933
  const line = lines[i];
19934
+ if (/^(`{3,}|~{3,})/.test(line.trim())) {
19935
+ inFence = !inFence;
19936
+ continue;
19937
+ }
19938
+ if (inFence)
19939
+ continue;
19751
19940
  const match = line.match(/^(\s*)([*\-+])\s+/);
19752
19941
  if (match) {
19753
19942
  const indent = match[1].length;
@@ -19861,18 +20050,49 @@ var init_ul_style = __esm(() => {
19861
20050
  });
19862
20051
 
19863
20052
  // ../pickier/src/plugins/markdown.ts
20053
+ function stripFrontmatter(content) {
20054
+ const lines = content.split(/\r?\n/);
20055
+ if (lines[0]?.trim() !== "---")
20056
+ return { text: content, frontmatter: null, frontmatterEndLine: 0 };
20057
+ for (let i = 1;i < lines.length; i++) {
20058
+ if (lines[i].trim() === "---") {
20059
+ const frontmatter = lines.slice(0, i + 1);
20060
+ const blanked = frontmatter.map(() => "");
20061
+ return {
20062
+ text: [...blanked, ...lines.slice(i + 1)].join(`
20063
+ `),
20064
+ frontmatter,
20065
+ frontmatterEndLine: i + 1
20066
+ };
20067
+ }
20068
+ }
20069
+ return { text: content, frontmatter: null, frontmatterEndLine: 0 };
20070
+ }
20071
+ function restoreFrontmatter(content, frontmatter) {
20072
+ if (!frontmatter)
20073
+ return content;
20074
+ const lines = content.split(/\r?\n/);
20075
+ return [...frontmatter, ...lines.slice(frontmatter.length)].join(`
20076
+ `);
20077
+ }
19864
20078
  function markdownOnly(rule) {
19865
20079
  return {
19866
20080
  meta: rule.meta,
19867
20081
  check: (content, context) => {
19868
20082
  if (!context.filePath.endsWith(".md"))
19869
20083
  return [];
19870
- return rule.check(content, context);
20084
+ const { text, frontmatterEndLine } = stripFrontmatter(content);
20085
+ const issues = rule.check(text, context);
20086
+ if (frontmatterEndLine > 0)
20087
+ return issues.filter((issue) => issue.line > frontmatterEndLine + 1);
20088
+ return issues;
19871
20089
  },
19872
20090
  fix: rule.fix ? (content, context) => {
19873
20091
  if (!context.filePath.endsWith(".md"))
19874
20092
  return content;
19875
- return rule.fix(content, context);
20093
+ const { text, frontmatter } = stripFrontmatter(content);
20094
+ const fixed = rule.fix(text, context);
20095
+ return restoreFrontmatter(fixed, frontmatter);
19876
20096
  } : undefined
19877
20097
  };
19878
20098
  }
@@ -25561,13 +25781,13 @@ var init_style = __esm(() => {
25561
25781
  stylePlugin = {
25562
25782
  name: "style",
25563
25783
  rules: {
25564
- "brace-style": braceStyle,
25565
- curly: curlyRule,
25566
- "max-statements-per-line": maxStatementsPerLineRule,
25567
- "if-newline": ifNewlineRule,
25568
- "consistent-chaining": consistentChainingRule,
25569
- "consistent-list-newline": consistentListNewlineRule,
25570
- "indent-unindent": indentUnindentRule,
25784
+ "brace-style": codeOnly(braceStyle),
25785
+ curly: codeOnly(curlyRule),
25786
+ "max-statements-per-line": codeOnly(maxStatementsPerLineRule),
25787
+ "if-newline": codeOnly(ifNewlineRule),
25788
+ "consistent-chaining": codeOnly(consistentChainingRule),
25789
+ "consistent-list-newline": codeOnly(consistentListNewlineRule),
25790
+ "indent-unindent": codeOnly(indentUnindentRule),
25571
25791
  "no-multi-spaces": noMultiSpaces,
25572
25792
  "no-multiple-empty-lines": noMultipleEmptyLines,
25573
25793
  "no-trailing-spaces": noTrailingSpaces,
@@ -28331,6 +28551,18 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
28331
28551
  const wantNoCondAssign = sevMap(cfg.rules.noCondAssign);
28332
28552
  const consoleCall = /\bconsole\.log\s*\(/;
28333
28553
  const debuggerStmt = /^\s*debugger\b/;
28554
+ const linesInFencedCodeBlock = new Set;
28555
+ if (fileExt === "md") {
28556
+ let inFence = false;
28557
+ for (let li = 0;li < lines.length; li++) {
28558
+ if (/^(`{3,}|~{3,})/.test(lines[li].trim())) {
28559
+ inFence = !inFence;
28560
+ continue;
28561
+ }
28562
+ if (inFence)
28563
+ linesInFencedCodeBlock.add(li + 1);
28564
+ }
28565
+ }
28334
28566
  const linesInTemplate = new Set;
28335
28567
  let inTemplate = false;
28336
28568
  let escaped = false;
@@ -28379,7 +28611,7 @@ function scanContentOptimized(filePath, content, cfg, suppress, commentLines) {
28379
28611
  }
28380
28612
  const leadingMatch = line.match(/^[ \t]*/);
28381
28613
  const leading = leadingMatch ? leadingMatch[0] : "";
28382
- if (leading.length > 0 && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle)) {
28614
+ if (leading.length > 0 && !linesInFencedCodeBlock.has(lineNo) && hasIndentIssue(leading, cfg.format.indent, cfg.format.indentStyle, line)) {
28383
28615
  if (!isSuppressed("indent", lineNo, suppress))
28384
28616
  issues.push({ filePath, line: lineNo, column: 1, ruleId: "indent", message: "Incorrect indentation detected", severity: "warning", help: `Use ${cfg.format.indentStyle === "spaces" ? `${cfg.format.indent} spaces` : "tabs"} for indentation. Configure with format.indent and format.indentStyle in your config` });
28385
28617
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "pickier-vscode",
4
4
  "displayName": "Pickier",
5
5
  "type": "module",
6
- "version": "0.1.15",
6
+ "version": "0.1.16",
7
7
  "description": "Format, lint and more in a fraction of seconds with Pickier",
8
8
  "license": "MIT",
9
9
  "homepage": "https://github.com/pickier/pickier#readme",