Skip to content

Commit 2f90743

Browse files
authored
docs: correct the silent option description (#4150)
* docs: correct the silent option description The options table said silent never throws and never logs. Top-level parse errors are returned as an HTML error message instead of being thrown. An unknown token type is logged with console.error and rendered as an empty string. Signed-off-by: bin <[email protected]> * docs: separate silent error paths Caught parse errors are returned as HTML and are not logged. Lexer and parser recovery still logs with console.error. Signed-off-by: bin <[email protected]> --------- Signed-off-by: bin <[email protected]> Co-authored-by: bin <[email protected]>
1 parent b137d89 commit 2f90743

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎docs/USING_ADVANCED.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ console.log(marked.parse(markdownString));
5353
|gfm |`boolean` |`true` |v0.2.1 |If true, use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
5454
|pedantic |`boolean` |`false` |v0.2.1 |If true, conform to the original `markdown.pl` as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides `gfm`.|
5555
|renderer |`object` |`new Renderer()`|v0.3.0|An object containing functions to render tokens to HTML. See [extensibility](/using_pro) for more details.|
56-
|silent |`boolean` |`false` |v0.2.7 |If true, the parser does not throw any exception or log any warning. Any error will be returned as a string.|
56+
|silent |`boolean` |`false` |v0.2.7 |If true, errors caught by `marked.parse` / `marked.parseInline` are returned as an HTML error message instead of being thrown. Problems the lexer or parser recover from (an unknown token type, the infinite-loop guard) are logged with `console.error` instead of thrown.|
5757
|tokenizer |`object` |`new Tokenizer()`|v1.0.0|An object containing functions to create tokens from markdown. See [extensibility](/using_pro) for more details.|
5858
|walkTokens |`function` |`null`|v1.1.0|A function which is called for every token. See [extensibility](/using_pro) for more details.|
5959

‎src/MarkedOptions.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export interface MarkedExtension<ParserOutput = string, RendererOutput = string>
9696
renderer?: RendererObject<ParserOutput, RendererOutput> | null;
9797

9898
/**
99-
* Shows an HTML error message when rendering fails.
99+
* If true, errors caught by `marked.parse` / `marked.parseInline` are returned as an HTML error message instead of being thrown. Problems the lexer or parser recover from (an unknown token type, the infinite-loop guard) are logged with `console.error` instead of thrown.
100100
*/
101101
silent?: boolean;
102102

0 commit comments

Comments
 (0)