]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
mdwn: Don't enable alphabetically labelled ordered lists by default
authorSimon McVittie <smcv@debian.org>
Tue, 16 May 2017 06:58:12 +0000 (07:58 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 16 May 2017 07:09:15 +0000 (08:09 +0100)
This avoids misinterpreting initials ("C. S. Lewis was an author"),
the abbreviation for Monsieur ("M. Descartes was a philosopher") and
German page numbering ("S. 42") as ordered lists if they happen to
begin a line.

This only affects the default Discount implementation: Text::Markdown
and Text::MultiMarkdown do not have this feature anyway. A new
mdwn_alpha_list option can be used to restore the old interpretation.

IkiWiki/Plugin/mdwn.pm
debian/changelog
doc/plugins/mdwn.mdwn

index e142fec4633272d67c7feb79778f08b465d2e2cc..9f06c03f2ec05678e0426a723a352eab7475313c 100644 (file)
@@ -41,10 +41,19 @@ sub getsetup () {
                        safe => 1,
                        rebuild => 1,
                },
+               mdwn_alpha_lists => {
+                       type => "boolean",
+                       example => 0,
+                       description => "interpret line like 'A. First item' as ordered list when using Discount?",
+                       advanced => 1,
+                       safe => 1,
+                       rebuild => 1,
+               },
 }
 
 sub checkconfig () {
        $config{mdwn_footnotes} = 1 unless defined $config{mdwn_footnotes};
+       $config{mdwn_alpha_lists} = 0 unless defined $config{mdwn_alpha_lists};
 }
 
 my $markdown_sub;
@@ -101,6 +110,10 @@ sub htmlize (@) {
                                                $flags |= Text::Markdown::Discount::MKD_EXTRA_FOOTNOTE();
                                        }
 
+                                       unless ($config{mdwn_alpha_lists}) {
+                                               $flags |= Text::Markdown::Discount::MKD_NOALPHALIST();
+                                       }
+
                                        # Workaround for discount's eliding
                                        # of <style> blocks.
                                        # https://rt.cpan.org/Ticket/Display.html?id=74016
index e2a861c3cd35bd6453c58b6c2d27eeef3ca8f21e..455e5981f2dfa8e1268573011fb64fc196f0cb95 100644 (file)
@@ -11,6 +11,10 @@ ikiwiki (3.20170112) UNRELEASED; urgency=medium
   * mdwn: Enable footnotes by default when using the default Discount
     implementation. A new mdwn_footnotes option can be used to disable
     footnotes in MultiMarkdown and Discount.
+  * mdwn: Don't enable alphabetically labelled ordered lists by
+    default when using the default Discount implementation. A new
+    mdwn_alpha_list option can be used to restore the old
+    interpretation.
 
  -- Simon McVittie <smcv@debian.org>  Sun, 14 May 2017 15:34:52 +0100
 
index 6b20b7bb00a94fe9288c3f43295c1eeb5a41f255..31123715d246e47ddfcedf0b628d6a071c8bed93 100644 (file)
@@ -7,6 +7,8 @@ It uses the [[ikiwiki/markdown]] minimal markup language.
 This is the standard markup language used by ikiwiki, although some others
 are also available in other plugins.
 
+## Implementations
+
 There are several implementations of markdown support that can be used by
 this plugin. In order of preference:
 
@@ -27,3 +29,21 @@ in the setup file. Note that multimarkdown's metadata and wikilinks
 features are disabled when it's used with ikiwiki. Also note that if the
 `multimarkdown` option is enabled, it takes priority over Discount, which
 might cause formatting that is understood by Discount to be ignored.
+
+
+## Advanced options
+
+* `nodiscount`: If set to 1, Text::Markdown::Discount will not be used
+  even if it is available. The default is to use Discount if available,
+  and this is recommended.
+* `multimarkdown`: If set to 1, Text::MultiMarkdown will be used in
+  preference to Text::Markdown::Discount. The default is to not use
+  MultiMarkdown, and this is recommended.
+* `mdwn_footnotes`: If set to 1, implementations that support it will
+  recognise the PHP Markdown Extra syntax for footnotes. The default
+  is 1.
+* `mdwn_alpha_lists`: If set to 1, Text::Markdown::Discount will
+  accept letters as well as numbers in ordered list markers. The
+  default is 0, to avoid unintended parsing of lines that happen
+  to begin with a letter and a dot, such as "C. S. Lewis was an
+  author" or "M. Descartes was a philosopher".