Closed viki53 closed 2 years ago
The heading _shift option doesn't seem to work when sending a single string through the API.
heading _shift
A workaround has been to send an array with only that single string, such as:
$query = Http::post(config('zmarkdown.html'), [ 'md' => [ 'text' => $value, ], 'opts' => [ 'heading_shift' => 0, 'disable_ping' => true, 'disable_jsfiddle' => false, 'stats' => false, ] ]); $json = $query->json(); if (isset($json[0]) && isset($json[0]['text'])) { $this->attributes['content_html'] = $json[0]['text']; } else { $this->attributes['content_html'] = ''; }
This makes my code rather heavy and a bit dirty-looking, so it would be nice to be able to use this option without needing that extra array structure:
$query = Http::post(config('zmarkdown.html'), [ 'md' => $value, 'opts' => [ 'heading_shift' => 0, 'disable_ping' => true, 'disable_jsfiddle' => false, 'stats' => false, ] ]); $json = $query->json(); if (isset($json['text'])) { $this->attributes['content_html'] = $json[0]['text']; } else { $this->attributes['content_html'] = ''; }
Published in ZMarkdown version 11.1.0. An option enforce_shift was added, see upcoming changelog.
enforce_shift
Works great!
Just missing some documentation for new users, but I looked at the code and found how to use it 🙂
The
heading _shift
option doesn't seem to work when sending a single string through the API.A workaround has been to send an array with only that single string, such as:
This makes my code rather heavy and a bit dirty-looking, so it would be nice to be able to use this option without needing that extra array structure: