mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD037/no-space-in-emphasis to ignore emphasis on code fences and not report violations for scenarios that span an empty code fence (fixes #381).
This commit is contained in:
parent
c0218b2489
commit
c99ced2a7d
4 changed files with 35 additions and 4 deletions
|
|
@ -3412,11 +3412,19 @@ module.exports = {
|
||||||
resetRunTracking();
|
resetRunTracking();
|
||||||
forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) {
|
forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) {
|
||||||
var onItemStart = (inItem === 1);
|
var onItemStart = (inItem === 1);
|
||||||
if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) {
|
if (inCode ||
|
||||||
|
onFence ||
|
||||||
|
inTable ||
|
||||||
|
onBreak ||
|
||||||
|
onItemStart ||
|
||||||
|
isBlankLine(line)) {
|
||||||
// Emphasis resets when leaving a block
|
// Emphasis resets when leaving a block
|
||||||
resetRunTracking();
|
resetRunTracking();
|
||||||
}
|
}
|
||||||
if (inCode || onBreak || inMath) {
|
if (inCode ||
|
||||||
|
onFence ||
|
||||||
|
onBreak ||
|
||||||
|
inMath) {
|
||||||
// Emphasis has no meaning here
|
// Emphasis has no meaning here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
lib/md037.js
16
lib/md037.js
|
|
@ -78,11 +78,23 @@ module.exports = {
|
||||||
lineMetadata(),
|
lineMetadata(),
|
||||||
(line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) => {
|
(line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) => {
|
||||||
const onItemStart = (inItem === 1);
|
const onItemStart = (inItem === 1);
|
||||||
if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) {
|
if (
|
||||||
|
inCode ||
|
||||||
|
onFence ||
|
||||||
|
inTable ||
|
||||||
|
onBreak ||
|
||||||
|
onItemStart ||
|
||||||
|
isBlankLine(line)
|
||||||
|
) {
|
||||||
// Emphasis resets when leaving a block
|
// Emphasis resets when leaving a block
|
||||||
resetRunTracking();
|
resetRunTracking();
|
||||||
}
|
}
|
||||||
if (inCode || onBreak || inMath) {
|
if (
|
||||||
|
inCode ||
|
||||||
|
onFence ||
|
||||||
|
onBreak ||
|
||||||
|
inMath
|
||||||
|
) {
|
||||||
// Emphasis has no meaning here
|
// Emphasis has no meaning here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,3 +120,10 @@ multi-line emphasis
|
||||||
scenario * that
|
scenario * that
|
||||||
should * not trigger
|
should * not trigger
|
||||||
violations * either`.
|
violations * either`.
|
||||||
|
|
||||||
|
<!-- markdownlint-disable MD031 -->
|
||||||
|
*text
|
||||||
|
```text
|
||||||
|
```
|
||||||
|
text *
|
||||||
|
<!-- markdownlint-restore -->
|
||||||
|
|
|
||||||
|
|
@ -341,3 +341,7 @@ text [reference*link] star * star text
|
||||||
| x** y | x** y |
|
| x** y | x** y |
|
||||||
| x _ y | x _ y |
|
| x _ y | x _ y |
|
||||||
| x__ y | x__ y |
|
| x__ y | x__ y |
|
||||||
|
|
||||||
|
```yaml /* autogenerated */
|
||||||
|
# YAML...
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue