diff --git a/src/Converter.php b/src/Converter.php index f157323..8545a55 100644 --- a/src/Converter.php +++ b/src/Converter.php @@ -227,6 +227,13 @@ class Converter */ protected $indent = ''; + /** + * previous indentation, when we want to disable current indentation and get it back later + * + * @var string + */ + static $previousIndent = ''; + /** * constructor, set options, setup parser * @@ -534,8 +541,7 @@ protected function handleTagToText() // don't indent inside
tags if ($this->parser->tagName == 'pre') { $this->out($this->parser->node); - static $indent; - $indent = $this->indent; + $this->previousIndent = $this->indent; $this->indent = ''; } else { $this->out($this->parser->node . "\n" . $this->indent); @@ -556,8 +562,7 @@ protected function handleTagToText() } else { // reset indentation $this->out($this->parser->node); - static $indent; - $this->indent = $indent; + $this->indent = $this->previousIndent; } if (in_array($this->parent(), ['ins', 'del'])) {