diff --git a/flags.c b/flags.c index 5e6feb7..94b7827 100644 --- a/flags.c +++ b/flags.c @@ -15,7 +15,7 @@ static struct flagnames flagnames[] = { { MKD_NO_EXT, "!EXT" }, { MKD_CDATA, "CDATA" }, { MKD_NOSUPERSCRIPT, "!SUPERSCRIPT" }, - { MKD_NORELAXED, "!RELAXED" }, + { MKD_STRICT, "STRICT" }, { MKD_NOTABLES, "!TABLES" }, { MKD_NOSTRIKETHROUGH,"!STRIKETHROUGH" }, { MKD_TOC, "TOC" }, diff --git a/generate.c b/generate.c index 6a43a1d..dfece86 100644 --- a/generate.c +++ b/generate.c @@ -1353,6 +1353,7 @@ text(MMIOT *f) break; /* A^B -> AB */ case '^': if ( is_flag_set(&f->flags, MKD_NOSUPERSCRIPT) + || is_flag_set(&f->flags, MKD_STRICT) || is_flag_set(&f->flags, MKD_TAGTEXT) || (f->last == 0) || ((ispunct(f->last) || isspace(f->last)) @@ -1390,7 +1391,7 @@ text(MMIOT *f) break; case '_': /* Underscores don't count if they're in the middle of a word */ - if ( !is_flag_set(&f->flags, MKD_NORELAXED) + if ( !is_flag_set(&f->flags, MKD_STRICT) && isthisalnum(f,-1) && isthisalnum(f,1) ) { Qchar(c, f); break; @@ -1418,9 +1419,9 @@ text(MMIOT *f) #define ticktick(f,c) tickhandler(f,c,2,0,delspan) #endif - case '~': if ( is_flag_set(f->flags, MKD_NOSTRIKETHROUGH) - || is_flag_set(f->flags, MKD_STRICT) - || is_flag_set(f->flags, MKD_TAGTEXT) + case '~': if ( is_flag_set(&f->flags, MKD_NOSTRIKETHROUGH) + || is_flag_set(&f->flags, MKD_STRICT) + || is_flag_set(&f->flags, MKD_TAGTEXT) || !ticktick(f,c) ) Qchar(c, f); break; diff --git a/markdown.h b/markdown.h index 91a5047..95753a0 100644 --- a/markdown.h +++ b/markdown.h @@ -23,7 +23,7 @@ enum { MKD_NOLINKS=0, /* don't do link processing, block tags */ MKD_EXPLICITLIST, /* don't combine numbered/bulletted lists */ MKD_CDATA, /* generate code for xml ![CDATA[...]] */ MKD_NOSUPERSCRIPT, /* no A^B */ - MKD_NORELAXED, /* emphasis happens /everywhere/ */ + MKD_STRICT, /* conform to Markdown.pl behavior */ MKD_NOTABLES, /* disallow tables */ MKD_NOSTRIKETHROUGH, /* forbid ~~strikethrough~~ */ MKD_1_COMPAT, /* compatibility with MarkdownTest_1.0 */ diff --git a/pgm_options.c b/pgm_options.c index b67cdbf..ec1b22b 100644 --- a/pgm_options.c +++ b/pgm_options.c @@ -21,7 +21,6 @@ #endif static void set_dlist(mkd_flag_t *flags, int enable); -extern void ___mkd_strict_mode(mkd_flag_t *flags, int enable); static struct _special { char *name; @@ -29,7 +28,6 @@ static struct _special { } special[] = { { "definitionlist", set_dlist }, { "dlist", set_dlist }, - { "standard", ___mkd_strict_mode }, }; static struct _opt { @@ -45,8 +43,9 @@ static struct _opt { { "tabstop", "default (4-space) tabstops", 0, 0, 0, 1, MKD_TABSTOP }, { "image", "images", 0, 1, 0, 1, MKD_NOIMAGE }, { "links", "links", 0, 1, 0, 1, MKD_NOLINKS }, - { "strict", "emphasis inside words", 0, 0, 0, 1, MKD_NORELAXED }, - { "relax", "emphasis inside words", 0, 1, 1, 1, MKD_NORELAXED }, + { "strict", "conform to the markdown standard", 0, 0, 0, 1, MKD_STRICT }, + { "relax", "conform to the markdown standard", 0, 1, 1, 1, MKD_STRICT }, + { "standard", "conform to the markdown standard", 0, 0, 1, 1, MKD_STRICT }, { "tables", "tables", 0, 1, 0, 1, MKD_NOTABLES }, { "header", "pandoc-style headers", 0, 1, 0, 1, MKD_NOHEADER }, { "html", "allow raw html", 0, 1, 0, 0, MKD_NOHTML }, @@ -79,7 +78,6 @@ static struct _opt { { "regular-listitem","github-style check items", 0, 0, 1, 1, MKD_NORMAL_LISTITEM } , { "definitionlist","both discount & markdown extra definition lists", 1 }, { "dlist", "both discount & markdown extra definition lists", 1, 0, 1 }, - { "standard", "conform to the markdown standard", 1 }, } ; #define NR(x) (sizeof x / sizeof x[0]) diff --git a/v2compat.c b/v2compat.c index 5ce0df0..9a6fa2b 100644 --- a/v2compat.c +++ b/v2compat.c @@ -34,7 +34,7 @@ #define MKD2_NO_EXT 0x00000040 #define MKD2_CDATA 0x00000080 #define MKD2_NOSUPERSCRIPT 0x00000100 -#define MKD2_NORELAXED 0x00000200 +#define MKD2_STRICT2 0x00000200 #define MKD2_NOTABLES 0x00000400 #define MKD2_NOSTRIKETHROUGH 0x00000800 #define MKD2_TOC 0x00001000 @@ -58,6 +58,7 @@ #define MKD2_EXPLICITLIST 0x80000000 +#if 0 void ___mkd_strict_mode(mkd_flag_t *flags, int enable) { @@ -75,7 +76,7 @@ ___mkd_strict_mode(mkd_flag_t *flags, int enable) set_mkd_flag(flags, MKD_NORMAL_LISTITEM); set_mkd_flag(flags, MKD_NO_EXT); set_mkd_flag(flags, MKD_NOSUPERSCRIPT); - set_mkd_flag(flags, MKD_NORELAXED); + set_mkd_flag(flags, MKD_STRICT); set_mkd_flag(flags, MKD_NOTABLES); set_mkd_flag(flags, MKD_NOSTRIKETHROUGH); set_mkd_flag(flags, MKD_NOHEADER); @@ -84,6 +85,7 @@ ___mkd_strict_mode(mkd_flag_t *flags, int enable) set_mkd_flag(flags, MKD_NOSTYLE); } } +#endif /* @@ -105,7 +107,7 @@ convert_v2flags(DWORD bitmask, mkd_flag_t *blob) bit = 1L << i; switch ( bitmask & bit ) { - case MKD2_STRICT: ___mkd_strict_mode(blob, 1); + case MKD2_STRICT: set_mkd_flag(blob,MKD_STRICT); break; case MKD2_NOLINKS: set_mkd_flag(blob,MKD_NOLINKS); break; @@ -123,7 +125,7 @@ convert_v2flags(DWORD bitmask, mkd_flag_t *blob) break; case MKD2_NOSUPERSCRIPT:set_mkd_flag(blob,MKD_NOSUPERSCRIPT); break; - case MKD2_NORELAXED: set_mkd_flag(blob,MKD_NORELAXED); + case MKD2_STRICT2: set_mkd_flag(blob,MKD_STRICT); break; case MKD2_NOTABLES: set_mkd_flag(blob,MKD_NOTABLES); break;