Skip to content

Commit 732ef14

Browse files
committed
workaround
1 parent 8ff4373 commit 732ef14

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

modules/markup/markdown/markdown.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -185,44 +185,6 @@ func render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error
185185
rc := &RenderConfig{Meta: markup.RenderMetaAsDetails}
186186
// Extract metadata if present. If not present, ExtractMetadataBytes returns original contents and an error.
187187
buf, _ = ExtractMetadataBytes(buf, rc)
188-
/*
189-
// Only attempt to extract YAML front matter when the first line is a YAML separator
190-
// AND there is a matching closing separator later in the content.
191-
// If there is only a leading '---' (no closing '---'), we must not try to
192-
// extract metadata because that will be treated as normal markdown (a
193-
// thematic break) and should not interfere with goldmark parsing.
194-
firstLineEnd := bytes.IndexByte(buf, '\n')
195-
if firstLineEnd == -1 {
196-
firstLineEnd = len(buf)
197-
}
198-
firstLine := buf[:firstLineEnd]
199-
if isYAMLSeparator(firstLine) {
200-
// scan for a later line that is also a YAML separator
201-
foundClosing := false
202-
start := firstLineEnd + 1
203-
for start < len(buf) {
204-
end := len(buf)
205-
if idx := bytes.IndexByte(buf[start:], '\n'); idx >= 0 {
206-
end = start + idx
207-
}
208-
line := buf[start:end]
209-
if isYAMLSeparator(line) {
210-
foundClosing = true
211-
break
212-
}
213-
start = end + 1
214-
}
215-
if foundClosing {
216-
buf, _ = ExtractMetadataBytes(buf, rc)
217-
} else {
218-
// If there's an opening YAML separator but no closing one, some versions
219-
// of the goldmark parser can panic when parsing inline/code spans.
220-
// Prepend a blank line so the leading '---' is treated as a thematic
221-
// break (horizontal rule) and not as frontmatter, matching the
222-
// behaviour when users insert an initial blank line.
223-
buf = append([]byte("\n"), buf...)
224-
}
225-
}*/
226188

227189
metaLength := max(bufWithMetadataLength-len(buf), 0)
228190
rc.metaLength = metaLength

0 commit comments

Comments
 (0)