From c622ba84b9aadd4377ce5ea283121ac27726ea83 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 30 Oct 2018 22:16:37 +0100 Subject: really fix html2markdown() - when using environment, we must set the defaults --- include/markdown.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/markdown.php b/include/markdown.php index 0947afeff..e7b57c3ee 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -288,10 +288,20 @@ function bb_to_markdown($Text, $options = []) { function html2markdown($html,$options = []) { $markdown = ''; - $internal_errors = libxml_use_internal_errors(true); + if(! $options) { + $options = [ + 'header_style' => 'setext', // Set to 'atx' to output H1 and H2 headers as # Header1 and ## Header2 + 'suppress_errors' => true, // Set to false to show warnings when loading malformed HTML + 'strip_tags' => false, // Set to true to strip tags that don't have markdown equivalents. N.B. Strips tags, not their content. Useful to clean MS Word HTML output. + 'bold_style' => '**', // DEPRECATED: Set to '__' if you prefer the underlined style + 'italic_style' => '*', // DEPRECATED: Set to '_' if you prefer the underlined style + 'remove_nodes' => '', // space-separated list of dom nodes that should be removed. example: 'meta style script' + 'hard_break' => false, // Set to true to turn
into `\n` instead of ` \n` + 'list_item_style' => '-', // Set the default character for each
  • in a