Code » md4c » commit 1b4c53a
Add BOLD extension so *foo* puts in bold
author | Olivier Brunel
<jjk@jjacky.com> 2022-12-28 10:37:45 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2022-12-28 10:38:47 UTC |
parent | 3c914ffc0044754cf54a3e7920bbaa7846ad432d |
src/md4c.c | +7 | -0 |
src/md4c.h | +1 | -0 |
diff --git a/src/md4c.c b/src/md4c.c index f479d38..485c12f 100644 --- a/src/md4c.c +++ b/src/md4c.c @@ -4251,6 +4251,13 @@ md_process_inlines(MD_CTX* ctx, const MD_LINE* lines, int n_lines) MD_FALLTHROUGH(); case '*': /* Emphasis, strong emphasis. */ + if(ctx->parser.flags & MD_FLAG_BOLD) { + if(mark->flags & MD_MARK_OPENER) + MD_ENTER_SPAN(MD_SPAN_STRONG, NULL); + else + MD_LEAVE_SPAN(MD_SPAN_STRONG, NULL); + break; + } if(mark->flags & MD_MARK_OPENER) { if((mark->end - off) % 2) { MD_ENTER_SPAN(MD_SPAN_EM, NULL); diff --git a/src/md4c.h b/src/md4c.h index 38619eb..80176d4 100644 --- a/src/md4c.h +++ b/src/md4c.h @@ -317,6 +317,7 @@ typedef struct MD_SPAN_WIKILINK { #define MD_FLAG_WIKILINKS 0x2000 /* Enable wiki links extension. */ #define MD_FLAG_UNDERLINE 0x4000 /* Enable underline extension (and disables '_' for normal emphasis). */ #define MD_FLAG_ITALIC 0x8000 /* Enable italic (/foo/) extension. */ +#define MD_FLAG_BOLD 0x10000 /* Enable bold extension */ #define MD_FLAG_PERMISSIVEAUTOLINKS (MD_FLAG_PERMISSIVEEMAILAUTOLINKS | MD_FLAG_PERMISSIVEURLAUTOLINKS | MD_FLAG_PERMISSIVEWWWAUTOLINKS) #define MD_FLAG_NOHTML (MD_FLAG_NOHTMLBLOCKS | MD_FLAG_NOHTMLSPANS)