Skip to content

Commit

Permalink
Merge branch 'release/4.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 27, 2020
2 parents 10a555d + 4fa3eaa commit 793bcd3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v4.2.3
## 04/27/2020

1. [](#improved)
* Configuration option to exclude default shortcodes [#86](https://github.com/getgrav/grav-plugin-shortcode-core/issues/86)
* Add support for `style` attribute in `[span]` shortcode [#88](https://github.com/getgrav/grav-plugin-shortcode-core/issues/88)
* Fix typos [#91](https://github.com/getgrav/grav-plugin-shortcode-core/issues/91)

# v4.2.2
## 03/04/2020

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ active: true
active_admin: true
admin_pages_only: true
parser: regex
include_default_shortcodes: true
custom_shortcodes:
load_fontawesome: false
```
Expand All @@ -54,7 +55,8 @@ load_fontawesome: false
* `active: true|false` toggles if shortcodes will be enabled site-wide or not
* `active_admin: true|false` toggles if shortcodes will be processed in the admin plugin
* `admin_pages_only: true|false` toggles if admin should only process shortcodes for Grav pages
* `parser: wordpress|regex|regular` let's you configure the parser to use.
* `parser: wordpress|regex|regular` let's you configure the parser to use
* `include_default_shortcodes: true|false` toggle the inclusion of shortcodes provided by this plugin
* `custom_shortcodes:` the path to a directory where you can put your custom shortcodes (e.g. `/user/custom/shortcodes`)
* `load_fontawesome: true|false` toggles if the fontawesome icon library should be loaded or not

Expand Down Expand Up @@ -312,7 +314,7 @@ Figure elements are the recommended way to add self-contained units of flow cont
The HTML `<mark></mark>` tag is extremely useful to highlight text in your pages, and serves like a highlighter pen. However, as we know that markdown inside of HTML is not processed, using this HTML is often not convenient as it means markdown inside will not be processed.
Another important usecase is trying to highlight code in a markdown text block, again the HTML tag doesn't work becuase the result is escaped and treated like any other code and simply displayed.
Another important usecase is trying to highlight code in a markdown text block, again the HTML tag doesn't work because the result is escaped and treated like any other code and simply displayed.
The solution is simple, just use the shortcode version instead:
Expand Down
4 changes: 3 additions & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Shortcode Core
version: 4.2.2
slug: shortcode-core
type: plugin
version: 4.2.3
description: "This plugin provides the core functionality for shortcode plugins"
icon: code
author:
Expand Down
6 changes: 4 additions & 2 deletions classes/shortcodes/SpanShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ public function init()
$this->shortcode->getHandlers()->add('span', static function(ShortcodeInterface $sc) {
$id = $sc->getParameter('id');
$class = $sc->getParameter('class');
$style = $sc->getParameter('style');

$id_output = $id ? 'id="' . $id . '" ': '';
$class_output = $class ? 'class="' . $class . '"' : '';
$style_output = $style ? 'style="' . $style . '"' : '';

return '<span ' . $id_output . ' ' . $class_output . '>' . $sc->getContent() . '</span>';
return '<span ' . $id_output . ' ' . $class_output . ' ' . $style_output . '>' . $sc->getContent() . '</span>';
});
}
}
}
5 changes: 4 additions & 1 deletion shortcode-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ public function onPageContent(Event $event)
*/
public function onShortcodeHandlers()
{
$this->shortcodes->registerAllShortcodes(__DIR__ . '/classes/shortcodes', ['ignore' => ['Shortcode', 'ShortcodeObject']]);
$include_default_shortcodes = $this->config->get('plugins.shortcode-core.include_default_shortcodes', true);
if ($include_default_shortcodes) {
$this->shortcodes->registerAllShortcodes(__DIR__ . '/classes/shortcodes', ['ignore' => ['Shortcode', 'ShortcodeObject']]);
}

// Add custom shortcodes directory if provided
$custom_shortcodes = $this->config->get('plugins.shortcode-core.custom_shortcodes');
Expand Down
1 change: 1 addition & 0 deletions shortcode-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ active: true
active_admin: true
admin_pages_only: true
parser: regular
include_default_shortcodes: true
custom_shortcodes:
fontawesome:
load: true
Expand Down

0 comments on commit 793bcd3

Please sign in to comment.