Commit 96ed9d9b authored by Administrator's avatar Administrator 💬

Update our markdown-underline plugin.

It is now submitted.
parent 7b921a4f
...@@ -3,3 +3,5 @@ ...@@ -3,3 +3,5 @@
1. [](#new) 1. [](#new)
* Convert double underscore inline blocks to underline. * Convert double underscore inline blocks to underline.
* Allow override of the 4 basic inline blocks.
* Allow per-page override of the configuration
# Markdown Underline Plugin # Markdown Underline Plugin
Overrides the default behavior to convert double underscore `__` inline blocks to underline `<u>` instead of `<strong>`. Overrides the default behavior to convert for example double underscore `__` inline blocks to underline `<u>` instead of `<strong>`.
**Use with caution, as underlining makes text harder to read.** **Use with caution, as underlining makes text harder to read.**
...@@ -8,7 +8,7 @@ Overrides the default behavior to convert double underscore `__` inline blocks t ...@@ -8,7 +8,7 @@ Overrides the default behavior to convert double underscore `__` inline blocks t
Anyways, it's just another tag for your CSS to tinker with, you don't have to underline. Anyways, it's just another tag for your CSS to tinker with, you don't have to underline.
The **Markdown Underline** Plugin is for [Grav CMS](http://github.com/getgrav/grav). Use __double underscore__ create `<u>` tags. The **Markdown Underline** Plugin is for [Grav CMS](http://github.com/getgrav/grav).
## Installation ## Installation
...@@ -16,8 +16,6 @@ Installing the Markdown Underline plugin can be done in one of two ways. The GPM ...@@ -16,8 +16,6 @@ Installing the Markdown Underline plugin can be done in one of two ways. The GPM
### GPM Installation (Preferred) ### GPM Installation (Preferred)
!! NOT SUBMITTED YET
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type: The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install markdown-underline bin/gpm install markdown-underline
...@@ -46,18 +44,27 @@ Here is the default configuration and an explanation of available options: ...@@ -46,18 +44,27 @@ Here is the default configuration and an explanation of available options:
```yaml ```yaml
enabled: true enabled: true
'*': em
'**': strong
'_': em
'__': u
``` ```
Note that if you use the admin plugin, a file with your configuration, and named markdown-underline.yaml will be saved in the `user/config/plugins/` folder once the configuration is saved in the admin. Note that if you use the admin plugin, a file with your configuration, and named `markdown-underline.yaml` will be saved in the `user/config/plugins/` directory once the configuration is saved in the admin.
## Usage ## Usage
With the default configuration, when you write
This will be __underlined text__. This will be __underlined text__.
yields it will yield
This will be <u>underlined text</u>. This will be <u>underlined text</u>.
## Future You can also override the configuration in a page's frontmatter like so:
- Perhaps evolve into a plugin that allows individual overriding of `*`, `**`, `_`, `__` etc. ```yaml
\ No newline at end of file markdown-underline:
"__": i
```
...@@ -69,10 +69,9 @@ class MarkdownUnderlinePlugin extends Plugin ...@@ -69,10 +69,9 @@ class MarkdownUnderlinePlugin extends Plugin
$mu_config = $config->get('plugins.markdown-underline'); $mu_config = $config->get('plugins.markdown-underline');
// This feature depends on the page being provided in onMarkdownInitialized event. // This feature depends on the page being provided in onMarkdownInitialized event.
// There may be a PR for this in the future. Not sure about the implications. // See PR https://github.com/getgrav/grav/pull/2418
if (isset($event['page'])) { if (isset($event['page'])) {
$config = $this->mergeConfig($event['page']); $config = $this->mergeConfig($event['page']);
// Merging works but changes paths
$mu_config = array( $mu_config = array(
'*' => $config->get('*'), '*' => $config->get('*'),
'**' => $config->get('**'), '**' => $config->get('**'),
...@@ -122,7 +121,6 @@ class MarkdownUnderlinePlugin extends Plugin ...@@ -122,7 +121,6 @@ class MarkdownUnderlinePlugin extends Plugin
), ),
); );
}; };
$markdown->inlinePluginUnderline = $inlineUnderline->bindTo($markdown, $markdown); $markdown->inlinePluginUnderline = $inlineUnderline->bindTo($markdown, $markdown);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment