diff --git a/configure.sh b/configure.sh index 93c96a9c..964b1204 100755 --- a/configure.sh +++ b/configure.sh @@ -9,7 +9,6 @@ # ac_help='--enable-amalloc Enable memory allocation debugging --with-tabstops=N Set tabstops to N characters (default is 4) ---with-github-tags Allow `_` and `-` in <> tags --with-urlencoded-anchor Use url-encoded chars to multibyte chars in toc links --enable-all-features Turn on all stable optional features --shared Build shared libraries (default is static)' @@ -45,14 +44,13 @@ TARGET=markdown AC_INIT $TARGET -for banned_with in dl fenced-code id-anchor; do +for banned_with in dl fenced-code id-anchor github-tags; do banned_with_variable_ref=\$WITH_`echo "$banned_with" | $AC_UPPERCASE | tr - _` if [ "`eval echo "$banned_with_variable_ref"`" ]; then AC_FAIL "Invalid option: --with-$banned_with. Please use a runtime flag to configure this feature." fi done -test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 1 test "$WITH_URLENCODED_ANCHOR" && AC_DEFINE 'WITH_URLENCODED_ANCHOR' 1 test "$DEBIAN_GLITCH" && AC_DEFINE 'DEBIAN_GLITCH' 1 diff --git a/flags.c b/flags.c index 53717d54..3b12797e 100644 --- a/flags.c +++ b/flags.c @@ -34,6 +34,7 @@ static struct flagnames flagnames[] = { { MKD_DLEXTRA, "DLEXTRA" }, { MKD_FENCEDCODE, "FENCEDCODE" }, { MKD_IDANCHOR, "IDANCHOR" }, + { MKD_GITHUBTAGS, "GITHUBTAGS" }, }; #define NR(x) (sizeof x/sizeof x[0]) diff --git a/generate.c b/generate.c index a91949ea..888eeea8 100644 --- a/generate.c +++ b/generate.c @@ -1009,11 +1009,9 @@ maybe_tag_or_link(MMIOT *f) } else if ( isspace(c) ) break; -#if WITH_GITHUB_TAGS - else if ( ! (c == '/' || c == '-' || c == '_' || isalnum(c) ) ) -#else - else if ( ! (c == '/' || isalnum(c) ) ) -#endif + else if ( ! (c == '/' + || (f->flags & MKD_GITHUBTAGS && (c == '-' || c == '_')) + || isalnum(c) ) ) maybetag=0; } diff --git a/markdown.1 b/markdown.1 index b31ab096..eded7f49 100644 --- a/markdown.1 +++ b/markdown.1 @@ -123,6 +123,8 @@ Extract