Skip to content

Commit 8404155

Browse files
committed
complete editor pro compatibility + improved README.md
Signed-off-by: Andy Miller <[email protected]>
1 parent 143f5a8 commit 8404155

File tree

2 files changed

+142
-40
lines changed

2 files changed

+142
-40
lines changed

README.md

Lines changed: 116 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@ The **Shortcode Core** plugin allow for the development of simple yet powerful s
66

77
This plugin uses the [Thunderer Advanced shortcode engine](https://github.com/thunderer/Shortcode). For more information please check out that repo on GitHub.
88

9+
## Available Shortcodes
10+
11+
The Shortcode Core plugin provides the following built-in shortcodes:
12+
13+
### Text Formatting
14+
- **[Underline](#underline)** - Underline text
15+
- **[Size](#font-size)** - Change font size
16+
- **[Color](#color)** - Change text color
17+
- **[Mark](#mark)** - Highlight/mark text
18+
19+
### Text Alignment
20+
- **[Left](#left-align)** - Left align text
21+
- **[Center](#center-align)** - Center align text
22+
- **[Right](#right-align)** - Right align text
23+
24+
### Containers
25+
- **[Div](#div)** - Wrap content in a div with classes/id
26+
- **[Span](#span)** - Wrap content in a span with classes/id
27+
- **[Columns](#columns)** - Create CSS columns
28+
- **[Details](#detailssummary)** - Collapsible content sections
29+
30+
### Content Elements
31+
- **[Headers](#headers)** - H1-H6 with classes/id
32+
- **[Figure](#figure)** - Figure with caption
33+
- **[Notice](#notice)** - Notice/alert boxes
34+
- **[Section](#section)** - Named content sections
35+
36+
### Special Functions
37+
- **[Raw](#raw)** - Prevent shortcode processing
38+
- **[Safe-Email](#safe-email)** - Encode email addresses
39+
- **[FontAwesome](#fontawesome)** - Insert FontAwesome icons
40+
- **[Language](#language)** - Language-specific content
41+
- **[Lorem](#lorem-ipsum)** - Generate lorem ipsum text
42+
943
## Quick Example
1044

1145
```
@@ -22,8 +56,6 @@ This will render:
2256

2357
![](assets/shortcode-core-1.png)
2458

25-
The core plugin required for any other shortcode specific plugin. Provides some basic BBCode style syntax such as underline, color, center, and size.
26-
2759
## Installation
2860

2961
Typically a plugin should be installed via [GPM](http://learn.getgrav.org/advanced/grav-gpm) (Grav Package Manager):
@@ -100,9 +132,9 @@ shortcode-core:
100132
parser: regex
101133
```
102134

103-
## Available Shortcodes
135+
## Shortcode Reference
104136

105-
The core plugin contains a few simple shortcodes that can be used as basic examples:
137+
### Text Formatting
106138

107139
#### Underline
108140

@@ -120,6 +152,15 @@ Set the size of some text to a specific pixel size
120152
This is [size=30]bigger text[/size]
121153
```
122154
155+
#### Color
156+
157+
Change the color of your text using color names or hex values
158+
159+
```
160+
This is [color=blue]blue text[/color]
161+
This is [color=#FF0000]red text[/color]
162+
```
163+
123164
#### Left Align
124165
125166
Left align the text between this shortcode
@@ -144,6 +185,7 @@ Right align the text between this shortcode
144185
[right]This text is right aligned[/right]
145186
```
146187
188+
### Containers
147189
148190
#### Div
149191
@@ -167,14 +209,20 @@ or
167209
[/div]
168210
```
169211
212+
### Content Elements
213+
170214
#### Headers
171215
172216
Allows you to add `id` and `class` attributes to HTML `h1` through `h6` tags:
173217
174218
```
175219
[h1 class="major"]This is my title[/h1]
220+
[h2 id="section-1" class="subtitle"]Section Title[/h2]
221+
[h3 class="fancy-header"]Subsection[/h3]
176222
```
177223
224+
Supports h1 through h6 with any combination of id and class attributes.
225+
178226
#### Span
179227
180228
Allows you to wrap markdown in an HTML `span` tag that supports both `id` and `class` attributes
@@ -183,6 +231,10 @@ Allows you to wrap markdown in an HTML `span` tag that supports both `id` and `c
183231
[span class="text-center"]
184232
This text is **centered** aligned
185233
[/span]
234+
235+
[span id="important" class="highlight"]
236+
This is **important** highlighted text
237+
[/span]
186238
```
187239
188240
#### Columns
@@ -432,28 +484,43 @@ Lorem ipsum dolor sit amet...
432484

433485
**Note:** The show/hide behaviour is not supported in IE 11 or Edge 18, and the element will be permanently open. You can check the current status of browser compatibility at [Can I Use](https://caniuse.com/#search=details).
434486

487+
### Special Functions
488+
435489
#### Lorem Ipsum
436490

437491
Useful for faking content, you can use a shortcode to quickly generate some random "lorem ipsum" text:
438492

439493
**Paragraphs:**
440494
```
441-
[lorem=5 /]
442-
443-
[lorem p=5 tag=div /]
495+
[lorem=5 /] # 5 paragraphs (shorthand)
496+
[lorem p=5 /] # 5 paragraphs
497+
[lorem p=5 tag=div /] # Wrap each paragraph in div tags
498+
[lorem p=3 tag=p /] # Wrap each paragraph in p tags
444499
```
445500

446501
**Sentences:**
447502
```
448-
[lorem s=4 /]
503+
[lorem s=4 /] # 4 sentences
504+
[lorem sentences=10 /] # 10 sentences
449505
```
450506

451507
**Words:**
452508
```
453-
[lorem w=35 /]
509+
[lorem w=35 /] # 35 words
510+
[lorem words=50 /] # 50 words
454511
```
455512

456-
## Using Shortcodes in Twig
513+
**Options:**
514+
- `p` or `paragraphs` - Number of paragraphs to generate
515+
- `s` or `sentences` - Number of sentences to generate
516+
- `w` or `words` - Number of words to generate
517+
- `tag` - HTML tag to wrap each paragraph (only for paragraph mode)
518+
519+
The shorthand format `[lorem=X /]` defaults to generating X paragraphs.
520+
521+
## Advanced Usage
522+
523+
### Using Shortcodes in Twig
457524

458525
You can now use shortcodes in Twig templates and process them with the `|shortcodes` filter. For example:
459526

@@ -462,7 +529,7 @@ You can now use shortcodes in Twig templates and process them with the `|shortco
462529
{{ twig_text|shortcodes }}
463530
```
464531

465-
## Custom Shortcodes
532+
### Custom Shortcodes
466533

467534
### Simple Way
468535

@@ -550,7 +617,7 @@ The best way to see how to create a new shortcode-based plugins is to look at th
550617
* Section Shortcode Example: https://github.com/getgrav/grav-plugin-shortcode-core/blob/develop/shortcodes/SectionShortcode.php
551618
* Section Prism Highlight Example: https://github.com/trilbymedia/grav-plugin-prism-highlight/blob/develop/shortcodes/PrismShortcode.php
552619

553-
## Processing Shortcodes Before or After Markdown processing
620+
### Processing Shortcodes Before or After Markdown processing
554621

555622
There are basically two ways of processing a shortcode:
556623

@@ -574,10 +641,45 @@ $this->shortcode->getRawHandlers()->add('prism', function(ProcessedShortcode $sc
574641

575642
The difference here is it uses `getRawHandlers()` to ensure the handler is processed to the content in the _raw_ state.
576643

577-
## Display All Shortcodes
644+
### Display All Shortcodes
578645

579646
You can now display all available shortcodes by using the CLI command:
580647

581648
```shell
582649
bin/plugin shortcode-core display
583-
```
650+
```
651+
652+
## Troubleshooting
653+
654+
### Common Issues
655+
656+
1. **Shortcodes not processing**
657+
- Ensure the plugin is enabled
658+
- Check that `active: true` in configuration
659+
- Verify page doesn't have `shortcode-core: active: false` in frontmatter
660+
661+
2. **Shortcodes showing as plain text**
662+
- Check parser setting (should be `regular` or `regex`)
663+
- Clear Grav cache: `bin/grav cache`
664+
- Ensure `include_default_shortcodes: true`
665+
666+
3. **Custom shortcodes not loading**
667+
- Verify `custom_shortcodes` path is correct
668+
- Check file naming matches class name
669+
- Ensure proper namespace in PHP file
670+
671+
## Requirements
672+
673+
- Grav 1.4.0 or higher
674+
- PHP 7.1.3 or higher
675+
676+
## Credits
677+
678+
- [Thunderer Advanced Shortcode Engine](https://github.com/thunderer/Shortcode) - The powerful shortcode parsing library
679+
- [FontAwesome](https://fontawesome.com/) - Icon library for fa shortcode
680+
- [WordPress](https://wordpress.org/) - Inspiration for shortcode syntax
681+
- [Grav Team](https://getgrav.org) - For the amazing Grav CMS
682+
683+
## License
684+
685+
MIT License - See [LICENSE](LICENSE) file for details

0 commit comments

Comments
 (0)