Skip to content

Commit

Permalink
enhanced jetpack inline code regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiDittrich committed Aug 30, 2020
1 parent a4ecb65 commit 91c81b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/extensions/Jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static function init($gfmCode=false){
// preserve gfm style codeblocks + extended inline codeblocks
add_filter('jetpack_markdown_preserve_pattern', function ($patterns){
// exclude inline codeblocks (standard+extended)
$patterns[] = '/\s`[^`]+`\w*\s/U';
$patterns[] = '/(^|\s)`[^`]+`\w*(\s|$)/Um';

// exclude fenced codeblocks (GFM)
$patterns[] = '/^```[\S\s]+?```\s*$/m';
Expand Down
4 changes: 2 additions & 2 deletions views/admin/about/News.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

<div class="col-md-2">
<div class="news-section">
<h4>New languages</h4>
<h4>Jetpack Markdown Support</h4>

<div class="news-image">
<img
src="<?php echo \Enlighter\skltn\ResourceManager::getResourceUrl('about/routeros.png'); ?>"
alt="golang example">
</div>

<p>Support for R and MikroTik RouterOS/SwitchOS has been added</p>
<p>Use Jetpacks GFM style fenced codeblocks + inline code with Enlighter</p>

</div>

Expand Down
4 changes: 4 additions & 0 deletions views/admin/extensions/Jetpack.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@

<h4><?php _e('Markdown', 'enlighter'); ?></h4>

<p><?php _e('Note: this feature forces the Jetpack markdown renderer to exclude codeblocks from rendering (Enlighter renders the codeblocks during page delivery).', 'enlighter'); ?><br />
<?php _e('By disabling Enlighter or Jetpack later the codeblocks will still expressed in markdown and not as pre/code tag!', 'enlighter'); ?></p>

<!-- enable markdown support !-->
<?php $this->_settingsUtility->displayCheckbox(
__('Markdown codeblocks', 'enlighter'),
'jetpack-gfm-code',
array(
'label' => __('Enable', 'enlighter'),
'readmore' => 'https://github.com/EnlighterJS/documentation/blob/master/wordpress/FAQ.md#jetpack-markdown-codeblocks-not-working',
'description' => __('Enable Markdown style codeblocks (fenced+inline) for Jetpack Markdown. Requires enabled markdown editing mode!', 'enlighter')
)
); ?>
Expand Down

0 comments on commit 91c81b4

Please sign in to comment.