diff --git a/Plan9/README.md b/Plan9/README.md
index 342a93e1..b0ec8e3e 100644
--- a/Plan9/README.md
+++ b/Plan9/README.md
@@ -1,17 +1,15 @@
# *Discount* Markdown compiler on Plan 9
## Build
- % CONFIG='--with-dl=both' mk config
+ % CONFIG='--with-tabstops=7' mk config
% mk test
% mk install
% markdown -V
- markdown: discount X.Y.Z DL=BOTH
+ markdown: discount X.Y.Z TAB=7
### Configuration
-To select features and extensions, `--with-dl=both` may be replaced by zero or more of:
+To select features and extensions, `--with-tabstops=7` may be replaced by zero or more of:
-* `--enable-dl-tag`: Enable the definition list tag extension with the default (`discount`) tag style
-* `--with-dl=`*tagstyle*: Set the tags that define `
`s to *tagstyle*. *Tagstyle* must be one of `discount`, `extra`, or `both`. Implies `--enable-dl-tag`.
* `--enable-pandoc-header`: Use pandoc-style header blocks
* `--enable-superscript`: `A^B` becomes AB
* `--enable-amalloc`: Enable memory allocation debugging
@@ -33,6 +31,3 @@ Installation is optional. Plan 9 binaries are statically linked.
* `install.progs`: Extra programs. *makepage* writes complete XHTML
documents, rather than fragments. *mkd2html* is similar, but produces
HTML.
-
-3. `CONFIG`, the argument list given to `../configure.sh`, must contain at least `--with-dl=both` to produce a binary that
-passes `../discount/tests/dl.t`.
diff --git a/configure.sh b/configure.sh
index bc73383a..9c72a053 100755
--- a/configure.sh
+++ b/configure.sh
@@ -9,11 +9,6 @@
#
ac_help='--enable-amalloc Enable memory allocation debugging
--with-tabstops=N Set tabstops to N characters (default is 4)
---with-dl=X Use Discount, Extra, or Both types of definition list
---with-id-anchor Use id= anchors for table-of-contents links
---with-github-tags Allow `_` and `-` in <> tags
---with-fenced-code Allow fenced code blocks
---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)'
@@ -48,20 +43,13 @@ TARGET=markdown
AC_INIT $TARGET
-__DL=`echo "$WITH_DL" | $AC_UPPERCASE`
+for banned_with in dl fenced-code id-anchor github-tags urlencoded-anchor; 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
-case "$__DL" in
-EXTRA) AC_DEFINE 'USE_EXTRA_DL' 1 ;;
-DISCOUNT|1|"") AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
-BOTH) AC_DEFINE 'USE_EXTRA_DL' 1
- AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
-*) AC_FAIL "Unknown value <$WITH_DL> for --with-dl (want 'discount', 'extra', or 'both')" ;;
-esac
-
-test "$WITH_FENCED_CODE" && AC_DEFINE "WITH_FENCED_CODE" 1
-test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1
-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
AC_PROG_CC
diff --git a/flags.c b/flags.c
index cc1c589a..0bd146d8 100644
--- a/flags.c
+++ b/flags.c
@@ -30,6 +30,12 @@ static struct flagnames flagnames[] = {
{ MKD_NODLIST, "!DLIST" },
{ MKD_EXTRA_FOOTNOTE, "FOOTNOTE" },
{ MKD_NOSTYLE, "!STYLE" },
+ { MKD_NODLDISCOUNT, "!DLDISCOUNT" },
+ { MKD_DLEXTRA, "DLEXTRA" },
+ { MKD_FENCEDCODE, "FENCEDCODE" },
+ { MKD_IDANCHOR, "IDANCHOR" },
+ { MKD_GITHUBTAGS, "GITHUBTAGS" },
+ { MKD_URLENCODEDANCHOR, "URLENCODEDANCHOR" },
};
#define NR(x) (sizeof x/sizeof x[0])
diff --git a/generate.c b/generate.c
index 6573fc49..2bef56eb 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;
}
@@ -1426,26 +1424,26 @@ text(MMIOT *f)
static void
printheader(Paragraph *pp, MMIOT *f)
{
-#if WITH_ID_ANCHOR
- Qprintf(f, "hnumber);
- if ( f->flags & MKD_TOC ) {
- Qstring(" id=\"", f);
- mkd_string_to_anchor(T(pp->text->text),
- S(pp->text->text),
- (mkd_sta_function_t)Qchar, f, 1);
- Qchar('"', f);
- }
- Qchar('>', f);
-#else
- if ( f->flags & MKD_TOC ) {
- Qstring("text->text),
- S(pp->text->text),
- (mkd_sta_function_t)Qchar, f, 1);
- Qstring("\">\n", f);
+ if ( f->flags & MKD_IDANCHOR ) {
+ Qprintf(f, "hnumber);
+ if ( f->flags & MKD_TOC ) {
+ Qstring(" id=\"", f);
+ mkd_string_to_anchor(T(pp->text->text),
+ S(pp->text->text),
+ (mkd_sta_function_t)Qchar, f, 1, f->flags);
+ Qchar('"', f);
+ }
+ Qchar('>', f);
+ } else {
+ if ( f->flags & MKD_TOC ) {
+ Qstring("text->text),
+ S(pp->text->text),
+ (mkd_sta_function_t)Qchar, f, 1, f->flags);
+ Qstring("\">\n", f);
+ }
+ Qprintf(f, "", pp->hnumber);
}
- Qprintf(f, "", pp->hnumber);
-#endif
push(T(pp->text->text), S(pp->text->text), f);
text(f);
Qprintf(f, "", pp->hnumber);
diff --git a/markdown.1 b/markdown.1
index 60ad8c61..481a3e1e 100644
--- a/markdown.1
+++ b/markdown.1
@@ -106,11 +106,27 @@ blocks.
.It Ar alphalist
Allow alphabetic lists.
.It Ar definitionlist
-Allow definition lists.
+Allow definition lists at all (default). Use
+.Em dldiscount
+and
+.Em dlextra
+to control which syntaxes are respected.
+.It Ar dldiscount
+Enable discount-style definition lists (default).
+.It Ar dlextra
+Enable extra-style definition lists (not default). Both styles may be enabled simultaneously.
.It Ar footnote
Allow markdown extra-style footnotes.
-.It Ar styles
+.It Ar style
Extract