mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
add comments about errors
This commit is contained in:
parent
31ccfc4039
commit
7c7149f93c
2 changed files with 3 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ Convert Markdown documents with the CommonMark-compliant mode:
|
||||||
```go
|
```go
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
if err := goldmark.Convert(source, &buf); err != nil {
|
if err := goldmark.Convert(source, &buf); err != nil {
|
||||||
panic(err)
|
panic(err) // errors won't occur with in-memory buffer and default html renderers
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ var defaultMarkdown = New()
|
||||||
|
|
||||||
// Convert interprets a UTF-8 bytes source in Markdown and
|
// Convert interprets a UTF-8 bytes source in Markdown and
|
||||||
// write rendered contents to a writer w.
|
// 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 {
|
func Convert(source []byte, w io.Writer, opts ...parser.ParseOption) error {
|
||||||
return defaultMarkdown.Convert(source, w, opts...)
|
return defaultMarkdown.Convert(source, w, opts...)
|
||||||
}
|
}
|
||||||
|
|
@ -36,6 +37,7 @@ func Convert(source []byte, w io.Writer, opts ...parser.ParseOption) error {
|
||||||
type Markdown interface {
|
type Markdown interface {
|
||||||
// Convert interprets a UTF-8 bytes source in Markdown and write rendered
|
// Convert interprets a UTF-8 bytes source in Markdown and write rendered
|
||||||
// contents to a writer w.
|
// 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
|
Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error
|
||||||
|
|
||||||
// Parser returns a Parser that will be used for conversion.
|
// Parser returns a Parser that will be used for conversion.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue