Skip to content

Commit ac66bd3

Browse files
added readme usage and changed slug parameter to id
1 parent e1e81bc commit ac66bd3

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**This README.md file should be modified to describe the features, installation, configuration, and general usage of this plugin.**
44

5-
The **Codepen Embed** Plugin is for [Grav CMS](http://github.com/getgrav/grav). easily embed codepens from markdown
5+
The **Codepen Embed** Plugin is for [Grav CMS](http://github.com/getgrav/grav). You can use it to easily embed 'pens' from codepen.io right from your markdown editor.
66

77
## Installation
88

@@ -23,8 +23,9 @@ To install this plugin, just download the zip version of this repository and unz
2323
You should now have all the plugin files under
2424

2525
/your/site/grav/user/plugins/codepen-embed
26-
27-
> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) and the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) to operate.
26+
27+
> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) and the [Shortcode Core](https://github.com/getgrav/grav-plugin-shortcode-core)
28+
2829

2930
## Configuration
3031

@@ -38,7 +39,21 @@ enabled: true
3839
3940
## Usage
4041
41-
**Describe how to use the plugin.**
42+
```markdown
43+
[codepen id=CODEPEN_ID]
44+
```
45+
46+
You can use these parameters (only id is required)
47+
| Parameter | Default Value | Description |
48+
| ------------- | ------------- | ------------- |
49+
| id | The codepen from the url. For example on this pen: https://codepen.io/akm2/pen/rHIsa the id would be rHIsa |
50+
| user | required, no default |Include the pen user in the markup |
51+
| title | default: '' | Include the codepen |
52+
| preview | default: true. | Show preview of the pen once embedded |
53+
| height | default: 265 | Height of the pen embed |
54+
| defaultTab | default: js,result | What tabs should be shown by default |
55+
| content | default:'' | For SEO purposes you can also include content that will be removed once the pen has been embeded. |
56+
4257

4358
## Credits
4459

shortcodes/CodepenShortcode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function init(){
1717
$defaultTab = $sc->getParameter('defaultTab', 'js,result');
1818

1919
$output = $this->twig->processTemplate('partials/codepen.html.twig', [
20-
'slug' => $id,
20+
'id' => $id,
2121
'user' => $user,
2222
'title' => $title,
2323
'preview' => $preview,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="codepen-wrapper">
2-
<p data-height="{{height}}" data-theme-id="0" data-slug-hash="{{slug}}" data-default-tab="{{defaultTab}}" data-user="{{user}}" data-embed-version="2" data-pen-title="{{title}}" data-preview="{{preview}}" class="codepen">{{content | markdown}}</p>
2+
<p data-height="{{height}}" data-theme-id="0" data-slug-hash="{{id}}" data-default-tab="{{defaultTab}}" data-user="{{user}}" data-embed-version="2" data-pen-title="{{title}}" data-preview="{{preview}}" class="codepen">{{content | markdown}}</p>
33
</div>

0 commit comments

Comments
 (0)