mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Update MD038/no-space-in-code to allow code spans with only spaces (fixes #1481).
This commit is contained in:
parent
2d2fafc58d
commit
90cf515ff0
7 changed files with 56 additions and 68 deletions
|
|
@ -6,6 +6,7 @@ import { filterByTypesCached } from "./cache.mjs";
|
|||
|
||||
const leftSpaceRe = /^\s(?:[^`]|$)/;
|
||||
const rightSpaceRe = /[^`]\s$/;
|
||||
const allSpaceRe = /^\s*$/;
|
||||
const trimCodeText = (text, start, end) => {
|
||||
text = text.replace(/^\s+$/, "");
|
||||
if (start) {
|
||||
|
|
@ -35,7 +36,10 @@ export default {
|
|||
if (startSequence && endSequence && startData && endData) {
|
||||
const spaceLeft = leftSpaceRe.test(startData.text);
|
||||
const spaceRight = rightSpaceRe.test(endData.text);
|
||||
if (spaceLeft || spaceRight) {
|
||||
if (
|
||||
(spaceLeft || spaceRight) &&
|
||||
!datas.every((data) => allSpaceRe.test(data.text))
|
||||
) {
|
||||
let lineNumber = startSequence.startLine;
|
||||
let range = undefined;
|
||||
let fixInfo = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue