From 32862223ad2e8446a0cbb100d90b2bd4d7938dfe Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 12 Feb 2021 20:57:53 -0700 Subject: [PATCH] Markdown.pl: make the default yaml API mode match CLI The default YAML mode from the command line shows unknown YAML options in a table prefixed to the output and applies the ones it recognizes. Make the API have the same default mode rather than silently discarding unknown YAML options and ignoring known ones. Signed-off-by: Kyle J. McKay --- Markdown.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index ac90e1c..2c51364 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -765,6 +765,7 @@ sub ProcessRaw { # if < 0 any YAML front matter will be parsed but no # options will be applied at all. When != 0 the parsed # YAML front matter can be retrieved via the 'yaml' key. +# defaults to 1 if not defined or not a number. # yamlvis => 0 (invisible), > 0 (visible), < 0 (vis if unknown) # if yamlmode == 0 then yamlvis has no effect. if > 0 # then any parsed YAML front matter options will be shown @@ -773,6 +774,7 @@ sub ProcessRaw { # if < 0 then YAML front matter options will be shown in # the formatted output only if there are any unrecognized # options present. +# defaults to -1 if not defined or not a number. # keepabs => any-false-value (no action), any-true-value (keep) # if true, any absolute path URLs remaining after applying # any abs_prefix value will be kept and not be subject @@ -925,10 +927,10 @@ sub _SanitizeOpts { # already exists). delete $o->{h1}; - # Default is to silently strip any YAML front matter + # Default is to silently strip any known YAML front matter # Same comment about "yaml" key as above for "h1" key - $o->{yamlmode} = -1 unless looks_like_number($o->{yamlmode}); - $o->{yamlvis} = 0 unless looks_like_number($o->{yamlvis}); + $o->{yamlmode} = 1 unless looks_like_number($o->{yamlmode}); + $o->{yamlvis} = -1 unless looks_like_number($o->{yamlvis}); delete $o->{yaml}; # The anchors hash will only be returned if the key exists