This commit is contained in:
Artem Zakirullin 2025-03-03 22:46:25 +01:00 committed by GitHub
commit 2b7d75d210
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -77,7 +77,7 @@ Convert Markdown documents with the CommonMark-compliant mode:
```go
var buf bytes.Buffer
if err := goldmark.Convert(source, &buf); err != nil {
panic(err)
panic(err) // errors won't occur with in-memory buffer and default html renderers
}
```

View file

@ -28,6 +28,7 @@ var defaultMarkdown = New()
// Convert interprets a UTF-8 bytes source in Markdown and
// write rendered contents to a writer w.
// Errors are reported as per the Writer interface and provided renderers.
func Convert(source []byte, w io.Writer, opts ...parser.ParseOption) error {
return defaultMarkdown.Convert(source, w, opts...)
}
@ -37,6 +38,7 @@ func Convert(source []byte, w io.Writer, opts ...parser.ParseOption) error {
type Markdown interface {
// Convert interprets a UTF-8 bytes source in Markdown and write rendered
// contents to a writer w.
// Errors are reported as per the Writer interface and provided renderers.
Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error
// Parser returns a Parser that will be used for conversion.