markup/goldmark: Fail on invalid Markdown attributes

This commit is contained in:
Bjørn Erik Pedersen
2023-03-14 12:45:09 +01:00
parent 0fbab7cbc5
commit b0b1b76dc9
5 changed files with 89 additions and 10 deletions

View File

@@ -617,7 +617,13 @@ func (p *pageState) wrapError(err error) error {
}
}
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, herrors.NopLineMatcher)
lineMatcher := herrors.NopLineMatcher
if textSegmentErr, ok := err.(*herrors.TextSegmentError); ok {
lineMatcher = herrors.ContainsMatcher(textSegmentErr.Segment)
}
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, lineMatcher)
}