Skip to content

Commit 412cdc3

Browse files
authored
Doc and clean (#28)
Preparing release
1 parent ed4dfe2 commit 412cdc3

File tree

4 files changed

+87
-78
lines changed

4 files changed

+87
-78
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ jobs:
77
name: Build
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Ruby 2.6
12-
uses: actions/setup-ruby@v1
13-
with:
14-
ruby-version: 2.6.x
15-
- name: Build and test with Rake
16-
run: |
17-
gem install bundler
18-
bundle install --jobs 4 --retry 3
19-
bundle exec rake
10+
- uses: actions/checkout@v2
11+
- name: Set up Ruby 2.6
12+
uses: actions/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6.x
15+
- name: Build and test with Rake
16+
run: |
17+
gem install bundler
18+
bundle install --jobs 4 --retry 3
19+
bundle exec rake
20+
2021
# - name: Lint with Rubocop
2122
# run: |
2223
# bundle exec rubocop

README.md

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Premonition
22

3-
NOTE: This is the documentation for the version 4 release, coming soon. For 2.x documentation, please switch to the `2.x` branch.
4-
53
[Demo site](https://lazee.github.io/premonition-demo/) ([Source code](https://github.com/lazee/premonition-demo))
64

7-
Premonition is a higly customizable [Jekyll](https://jekyllrb.com/) plugin that can convert Markdown block-quotes into beautiful block styled content.
5+
Premonition is a higly customizable [Jekyll](https://jekyllrb.com/) plugin that can convert Markdown block-quotes into beautiful block styled content.
86

97
By simply adding a custom header to the first line of a [block quote](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#blockquotes), Premonition will transform it into a markup block of your choice.
108

@@ -14,46 +12,46 @@ By simply adding a custom header to the first line of a [block quote](https://gi
1412

1513
## Features
1614

17-
* Highly customizable (Create your own styles and templates easily)
18-
* Non-intrusive - Its just Markdown!
19-
* Easy to install
20-
* Comes with a default stylesheet (Sass/Css) and templates for beautiful messages boxes and citation.
21-
* Font Awesome 5 support
22-
23-
## Version 4 Highlights
24-
25-
* Jekyll [Post Excerpts](https://jekyllrb.com/docs/posts/#post-excerpts) support
26-
* New install command for the default stylesheet.
27-
* [Kramdown reference links](https://kramdown.gettalong.org/quickref.html#links-and-images) support
28-
* Jekyll 4 support (3.7 still supported)
29-
* Added support for block attributes (See documentation further down)
30-
* Added new citation block type.
31-
* Minor fixes to the Premonition stylesheet.
32-
* Removed the need Font Awesome css in default stylesheet, but
33-
Font Awesome is still supported.
34-
* Other bug fixes. See HISTORY.md.
35-
36-
See UPGRADE.md for help on how to upgrade from 2.x to 4.0.
37-
15+
- Highly customizable (Create your own styles and templates easily)
16+
- Non-intrusive - Its just Markdown!
17+
- Easy to install
18+
- Comes with a default stylesheet (Sass/Css) and templates for beautiful messages boxes and citation.
19+
- Font Awesome 5 support
20+
21+
## Version 4 Highlights
22+
23+
- Jekyll [Post Excerpts](https://jekyllrb.com/docs/posts/#post-excerpts) support
24+
- New install command for the default stylesheet.
25+
- [Kramdown reference links](https://kramdown.gettalong.org/quickref.html#links-and-images) support
26+
- Jekyll 4 support (3.7 still supported)
27+
- Added support for block attributes (See documentation further down)
28+
- Added new citation block type.
29+
- Minor fixes to the Premonition stylesheet.
30+
- Removed the need Font Awesome css in default stylesheet, but
31+
Font Awesome is still supported.
32+
- Other bug fixes. See HISTORY.md.
33+
34+
See UPGRADE.md for help on how to upgrade from 2.x to 4.0.
35+
3836
## Requirements
3937

40-
* Jekyll 3.7.x or higher (We recommend the new Jekyll 4)
41-
38+
- Jekyll 3.7.x or higher (We recommend the new Jekyll 4)
39+
4240
## Installation
4341

4442
Add the following line to your `Gemfile` inside your Jekyll project folder:
4543

4644
```
4745
group :jekyll_plugins do
48-
gem "premonition", "4.0.0.pre3"
46+
gem "premonition", "4.0.0"
4947
end
5048
```
5149

5250
Then add the the plugin to your `_config.yml`:
5351

5452
```yaml
5553
plugins:
56-
- premonition
54+
- premonition
5755
```
5856
5957
Now make sure to download the Premonition bundle:
@@ -89,54 +87,60 @@ defined by you in `_config.yml`.
8987

9088
The default types are:
9189

92-
* note
93-
* info
94-
* warning
95-
* error
96-
* citation
90+
- note
91+
- info
92+
- warning
93+
- error
94+
- citation
9795

98-
The *Title* will normally be the block header. Leave it empty to disable
96+
The _Title_ will normally be the block header. Leave it empty to disable
9997
the header.
10098

101-
*attributes* are in use by the Citation type, but can be skipped for the other default types. See section about custom types for more info.
99+
_attributes_ are in use by the Citation type, but can be skipped for the other default types. See section about custom types for more info.
102100

103101
### Examples
104102

105103
Simple note with no header
106-
~~~markdown
104+
105+
```markdown
107106
> note ""
108107
> No headers in here
109-
~~~
108+
```
110109

111110
Note
112-
~~~markdown
111+
112+
```markdown
113113
> note "I am a not"
114114
> The body of the note goes here. Premonition allows you to write any `Markdown` inside the block.
115-
~~~
115+
```
116116

117117
Info
118-
~~~markdown
118+
119+
```markdown
119120
> info "I am some info"
120121
> The body of the info box goes here. Premonition allows you to write any `Markdown` inside the block.
121-
~~~
122+
```
122123

123124
Warning
124-
~~~markdown
125+
126+
```markdown
125127
> warning "I am a warning"
126128
> The body of the warning box goes here. Premonition allows you to write any `Markdown` inside the block.
127-
~~~
129+
```
128130

129131
Error
130-
~~~markdown
132+
133+
```markdown
131134
> error "I am an error"
132135
> The body of the error box goes here. Premonition allows you to write any `Markdown` inside the block.
133-
~~~
136+
```
134137

135138
Citation (Note the use of attributes here)
136-
~~~markdown
139+
140+
```markdown
137141
> citations "Mark Twain" [ cite = "mt" ]
138142
> I will be a beautiful citation quote
139-
~~~
143+
```
140144

141145
## Configuration
142146

@@ -150,12 +154,12 @@ Like Jekyll itself, Premonition uses the [Liquid Markup Language](https://github
150154

151155
Six variables are available to the template engine:
152156

153-
* *header* Boolean that tells you if a title exists and that a header should be added.
154-
* *content* The rendered content for your block.
155-
* *title* The block title.
156-
* *type* The type name (eg: note).
157-
* *meta* This is a hash that can contain any properties you would like to make available to your template. It is configured in `_config.yml`
158-
* *attrs* These are the attributes set in the block header. Like we did in the Citation example above.
157+
- _header_ Boolean that tells you if a title exists and that a header should be added.
158+
- _content_ The rendered content for your block.
159+
- _title_ The block title.
160+
- _type_ The type name (eg: note).
161+
- _meta_ This is a hash that can contain any properties you would like to make available to your template. It is configured in `_config.yml`
162+
- _attrs_ These are the attributes set in the block header. Like we did in the Citation example above.
159163

160164
Take a look at our default template inside `lib/premonition/resources.rb` to
161165
get an idea of how this is done.
@@ -167,7 +171,7 @@ You can override the default template like this in your `_config.yml`:
167171
```yaml
168172
premonition:
169173
default:
170-
template: 'Liquid template goes here'
174+
template: "Liquid template goes here"
171175
```
172176
173177
#### Overriding the template for a default type
@@ -178,7 +182,7 @@ If you want to override the template for one of the default types (like note), d
178182
premonition:
179183
types:
180184
note:
181-
template: 'Liquid template goes here'
185+
template: "Liquid template goes here"
182186
```
183187
184188
### Adding custom types
@@ -188,24 +192,24 @@ of the defaults, or add a new one.
188192

189193
For each type you can
190194

191-
* Add a custom template (template)
192-
* Set a default title (default_title)
193-
* Set meta data that can be used inside the template
195+
- Add a custom template (template)
196+
- Set a default title (default_title)
197+
- Set meta data that can be used inside the template
194198

195199
Each type must have unique id (lowercase letters).
196200

197-
~~~yaml
201+
```yaml
198202
premonition:
199203
types:
200204
custombox:
201205
meta:
202-
my-meta: 'By myself'
206+
my-meta: "By myself"
203207
advanced:
204-
template: 'Liquid template goes here'
205-
default_title: 'MY BLOCK'
208+
template: "Liquid template goes here"
209+
default_title: "MY BLOCK"
206210
meta:
207-
my-meta: 'By myself'
208-
~~~
211+
my-meta: "By myself"
212+
```
209213

210214
## More on styling
211215

@@ -241,7 +245,7 @@ Then just add this to your `_config.yml`:
241245
premonition:
242246
types:
243247
error:
244-
fa-icon: 'fa-bug'
248+
fa-icon: "fa-bug"
245249
```
246250

247251
Simple as that :)

lib/premonition/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
module Jekyll
44
module Premonition
55
# Make sure to change this manually before a release.
6-
VERSION = '4.0.0.pre3'
6+
VERSION = '4.0.0'
77
end
88
end

test/config_test.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ def test_load_defaults
1515
assert_equal(cfg['default']['title'], nil)
1616
assert_equal(
1717
cfg['default']['template'],
18-
'<div class="premonition {{type}}"><div class="fa {{meta.fa-icon}}"></div>'\
19-
'<div class="content">{% if header %}<p class="header">{{title}}</p>{% endif %}{{content}}</div></div>'
18+
"<div class=\"premonition {% if meta.style %}{{meta.style}} {% endif %}{{type}}\">\n" +
19+
" <i class=\"{% if meta.fa-icon %}fas {{meta.fa-icon}}{% else %}premonition {{meta.pn-icon}}{% endif %}\"></i>\n" +
20+
" <div class=\"content\">\n" +
21+
" {% if header %}<p class=\"header\">{{title}}</p>{% endif %}{{content}}\n" +
22+
" </div>\n" +
23+
"</div>\n"
2024
)
2125
end
2226

0 commit comments

Comments
 (0)