From 7c7149f93cb9600b749c066d20443ac1afd6268e Mon Sep 17 00:00:00 2001 From: Artem Zakirullin Date: Sun, 18 Jun 2023 11:07:32 +0300 Subject: [PATCH] add comments about errors --- README.md | 2 +- markdown.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eaaf27e..91e16d9 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,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 } ``` diff --git a/markdown.go b/markdown.go index 86d12e2..189350d 100644 --- a/markdown.go +++ b/markdown.go @@ -27,6 +27,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...) } @@ -36,6 +37,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.