Add option to ignore usual indented code blocks
Markdown converts text with four spaces at the front of each line to code blocks. Of course we should support that, but when using fenced code blocks, indented one can even be harmful. There should be a way to turn them off. This patch adds option to disable indented code blocks.
This commit is contained in:
parent
9d39c07cb4
commit
d32be1c697
2 changed files with 3 additions and 2 deletions
|
@ -2392,7 +2392,7 @@ parse_block(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
|
|||
else if (prefix_quote(txt_data, end))
|
||||
beg += parse_blockquote(ob, rndr, txt_data, end);
|
||||
|
||||
else if (prefix_code(txt_data, end))
|
||||
else if (!(rndr->ext_flags & MKDEXT_DISABLE_INDENTED_CODE) && prefix_code(txt_data, end))
|
||||
beg += parse_blockcode(ob, rndr, txt_data, end);
|
||||
|
||||
else if (prefix_uli(txt_data, end))
|
||||
|
|
|
@ -59,7 +59,8 @@ enum mkd_extensions {
|
|||
MKDEXT_SPACE_HEADERS = (1 << 6),
|
||||
MKDEXT_SUPERSCRIPT = (1 << 7),
|
||||
MKDEXT_LAX_SPACING = (1 << 8),
|
||||
MKDEXT_FOOTNOTES = (1 << 9),
|
||||
MKDEXT_DISABLE_INDENTED_CODE = (1 << 9),
|
||||
MKDEXT_FOOTNOTES = (1 << 10),
|
||||
};
|
||||
|
||||
/* sd_callbacks - functions for rendering parsed data */
|
||||
|
|
Loading…
Reference in a new issue