jekyll_pre 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +102 -59
- data/lib/exec_tag.rb +1 -0
- data/lib/jekyll_pre/version.rb +1 -1
- data/lib/pre_tag_block.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 485abe28bdb36d30646e8213ac2efdc676137aedf5338110dbf03afd298f6c26
|
|
4
|
+
data.tar.gz: 8b968700fa134af7785c4ae7eb83386231c8a8a43db80aa7a4d5a1df06707850
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc4b43a1640ebd2b02c04a149cc463e86fb06d68ad676d8a9647f9b7a71ca3ac695ae216e2843dffcae96c1c57f3883241852990cb7fa6dd65d8d2120b558a2f
|
|
7
|
+
data.tar.gz: 73f99f9496fb90edb52e486b85426070906139cf5143e9cfeed1a954aee6f1247ba64e709f31d88cabf1aecccfc3bab1a9299cd3b5357bc8ce724581326fb9cf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,79 +1,89 @@
|
|
|
1
1
|
# Jekyll_pre [](https://badge.fury.io/rb/jekyll_pre)
|
|
2
2
|
|
|
3
|
-
This Jekyll plugin provides 3 new Liquid tags that work together:
|
|
3
|
+
This Jekyll plugin provides 3 new Liquid tags that work together: `pre`, `noselect` and `exec`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Provided Tags
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
{% pre [Options] [free text label] %}
|
|
9
|
-
Contents of pre tag
|
|
10
|
-
{% endpre %}
|
|
11
|
-
```
|
|
7
|
+
### `Pre`
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
A `pre` block tag can be displayed various ways.
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- `label='This is a label'` – Apply text above `pre` tag.
|
|
21
|
-
The `label` parameter value can also be specified in free text.
|
|
22
|
-
For example, the following produce the same results:
|
|
11
|
+
```html
|
|
12
|
+
{% pre [Options] [free text label] %}
|
|
13
|
+
Contents of pre tag
|
|
14
|
+
{% endpre %}
|
|
15
|
+
```
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
`Options` are:
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
* `class="class1 class2"` – Apply CSS classes
|
|
20
|
+
* `clear` – Line break after floating HTML elements
|
|
21
|
+
* `copyButton` – Generate a copy button
|
|
22
|
+
* `dark` – Dark mode
|
|
23
|
+
* `dedent` – Remove leading spaces common to all lines, like Ruby's <<~ squiggly heredoc (default is false)
|
|
24
|
+
* `id` ‐ Generate an `id` with the given value for the generated output.
|
|
25
|
+
* `label='This is a label'` – Apply text above `pre` tag.
|
|
26
|
+
The `label` parameter value can also be specified in free text.
|
|
27
|
+
For example, the following produce the same results:
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
[LanguageTool](https://forum.languagetool.org/t/avoid-spell-check-on-certain-html-inputs-manually/3944)
|
|
33
|
-
does not check the spelling or grammar of the contents.
|
|
29
|
+
* {% pre label="This is a label" %}<br>Contents of pre tag<br>{% endpre %}
|
|
34
30
|
|
|
35
|
-
*
|
|
36
|
-
|
|
31
|
+
* {% pre This is a label %}<br>Contents of pre tag<br>{% endpre %}
|
|
32
|
+
* `number` – Number the lines
|
|
33
|
+
* `shell` – Equivalent to `label='Shell'`
|
|
34
|
+
* `style` – Apply inline CSS styles
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{% noselect unselectable output goes here %}
|
|
42
|
-
{% endpre %}
|
|
43
|
-
```
|
|
36
|
+
The generated <pre></pre> tag has an `data-lt-active="false"` attribute, so
|
|
37
|
+
[LanguageTool](https://forum.languagetool.org/t/avoid-spell-check-on-certain-html-inputs-manually/3944)
|
|
38
|
+
does not check the spelling or grammar of the contents.
|
|
44
39
|
|
|
45
|
-
* An `exec` tag that executes shell commands and incorporates the command and its output into the content of the `pre` tag.
|
|
46
|
-
Environment variables are evaluated,
|
|
47
|
-
output data is escaped, whitespace is condensed, and wrapped in the same `unselectable` class as does `unselectable`.
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
### `Noselect`
|
|
42
|
+
|
|
43
|
+
A `noselect` tag renders HTML content passed to it unselectable,
|
|
44
|
+
and generates a <code>$</code> prompt if no content is provided.
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
```html
|
|
47
|
+
{% pre %}
|
|
48
|
+
{% noselect [optional text string, defaults to $]%}Command
|
|
49
|
+
{% noselect unselectable output goes here %}
|
|
50
|
+
{% endpre %}
|
|
51
|
+
```
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
Environment variables in the directory path will be expanded.
|
|
57
|
-
- `die_if_nonzero` – Set `false` to treat non-zero return codes as non-fatal.
|
|
58
|
-
Instead of terminating Jekyll with an error message,
|
|
59
|
-
the message will be displayed as an error by the Jekyll logger,
|
|
60
|
-
and a red message will appear in place of the result on the web page.
|
|
61
|
-
- `die_if_error` – Set `false` to treat exceptions generated by this plugin as non-fatal.
|
|
62
|
-
Instead of terminating Jekyll with an error message, the message will be displayed as an error by the Jekyll logger.
|
|
63
|
-
- `no_escape` – Do not HTML escape the result of running the shell command.
|
|
64
|
-
- `no_stderr` - Discard STDERR output.
|
|
65
|
-
This is helpful for suppressing annoying `groff` error messages that are emitted when the `exec` subcommand runs `man`.
|
|
66
|
-
Use it like this:
|
|
53
|
+
### `Exec`
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{% endpre %}
|
|
72
|
-
```
|
|
55
|
+
An `exec` tag executes shell commands and incorporates the command and its output into the content of the `pre` tag.
|
|
56
|
+
Environment variables are evaluated,
|
|
57
|
+
output data is escaped, whitespace is condensed, and wrapped in the same `unselectable` class as does `unselectable`.
|
|
73
58
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
```html
|
|
60
|
+
{% exec [Options] [shell command] %}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`Options` are:
|
|
64
|
+
|
|
65
|
+
* `cd="relative/or/absolute/directory"` - Change to specified directory before executing shell command.
|
|
66
|
+
Environment variables in the directory path will be expanded.
|
|
67
|
+
* `die_if_nonzero` – Set `false` to treat non-zero return codes as non-fatal.
|
|
68
|
+
Instead of terminating Jekyll with an error message,
|
|
69
|
+
the message will be displayed as an error by the Jekyll logger,
|
|
70
|
+
and a red message will appear in place of the result on the web page.
|
|
71
|
+
* `die_if_error` – Set `false` to treat exceptions generated by this plugin as non-fatal.
|
|
72
|
+
Instead of terminating Jekyll with an error message, the message will be displayed as an error by the Jekyll logger.
|
|
73
|
+
* `no_escape` – Do not HTML escape the result of running the shell command.
|
|
74
|
+
* `no_stderr` - Discard STDERR output.
|
|
75
|
+
This is helpful for suppressing annoying `groff` error messages that are emitted when the `exec` subcommand runs `man`.
|
|
76
|
+
Use it like this:
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
{% pre copyButton dedent shell %}
|
|
80
|
+
{% noselect %}{% exec no_stderr man netplan %}
|
|
81
|
+
{% endpre %}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
* `no_strip` – Do not remove leading and trailing whitespace from the result.
|
|
85
|
+
* `wrapper_class` class applied to outer `div`.
|
|
86
|
+
* `wrapper_style` style applied to outer `div`.
|
|
77
87
|
|
|
78
88
|
|
|
79
89
|
## Keyword Options
|
|
@@ -192,6 +202,8 @@ More information is available on
|
|
|
192
202
|
|
|
193
203
|
## Installation
|
|
194
204
|
|
|
205
|
+
### Gem
|
|
206
|
+
|
|
195
207
|
Add this line to your application's Gemfile, within the `jekyll_plugins` group:
|
|
196
208
|
|
|
197
209
|
```ruby
|
|
@@ -207,6 +219,37 @@ $ bundle
|
|
|
207
219
|
```
|
|
208
220
|
|
|
209
221
|
|
|
222
|
+
### CSS and Assets
|
|
223
|
+
|
|
224
|
+
Copy assets and CSS from the demo/ directory of the jekyll_pre GitHub project.
|
|
225
|
+
|
|
226
|
+
* Copy `demo/assets/images/clippy.svg` to a directory of the same name in your Jekyll project.
|
|
227
|
+
* Copy `demo/assets/css/jekyll_plugin_support.css` to your Jekyll project assets directory.
|
|
228
|
+
* Copy `demo/assets/css/shared_include_pre.css` to your Jekyll project assets directory.
|
|
229
|
+
* Copy `demo/assets/css/jekyll_pre.css` to your Jekyll project assets directory.
|
|
230
|
+
* Incorporate the CSS stylesheets into the appropriate layout in your Jekyll project:
|
|
231
|
+
|
|
232
|
+
```html
|
|
233
|
+
{% assign nowMillis = site.time | date: '%s' %}
|
|
234
|
+
<link rel="stylesheet" href="{{ '/assets/css/jekyll_plugin_support.css?v=' | append: nowMillis }}" type="text/css">
|
|
235
|
+
<link rel="stylesheet" href="{{ '/assets/css/shared_include_pre.css?v=' | append: nowMillis }}" type="text/css">
|
|
236
|
+
<link rel="stylesheet" href="{{ '/assets/css/jekyll_pre.css?v=' | append: nowMillis }}" type="text/css">
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
### JavaScript
|
|
241
|
+
|
|
242
|
+
Copy `demo/assets/js/clipboard.min.js` from the `jekyll_flexible_include_plugin` GitHub project
|
|
243
|
+
to your Jekyll project’s JavaScript directory.
|
|
244
|
+
|
|
245
|
+
Modify the Jekyll layout or selected pages to load the JavaScript.
|
|
246
|
+
You can load it from your project, as shown below, or from a CDN.
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<script defer src="/assets/js/clipboard.min.js"></script>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
|
|
210
253
|
## Usage
|
|
211
254
|
|
|
212
255
|
The following examples are rendered on
|
data/lib/exec_tag.rb
CHANGED
data/lib/jekyll_pre/version.rb
CHANGED
data/lib/pre_tag_block.rb
CHANGED
|
@@ -56,6 +56,7 @@ module JekyllPreModule
|
|
|
56
56
|
@dark = ' dark' if option 'dark'
|
|
57
57
|
@dedent = option 'dedent'
|
|
58
58
|
@highlight = option 'highlight'
|
|
59
|
+
@id = option 'id'
|
|
59
60
|
@make_copy_button = option 'copyButton'
|
|
60
61
|
@number_lines = option 'number'
|
|
61
62
|
@style = option 'style'
|
|
@@ -106,7 +107,7 @@ module JekyllPreModule
|
|
|
106
107
|
pre_content = "#{copy_button}#{content}"
|
|
107
108
|
attribution = @helper.attribute if @helper.attribution
|
|
108
109
|
<<~END_OUTPUT
|
|
109
|
-
<div class="jekyll_pre#{@wrapper_class}" #{@wrapper_style}>
|
|
110
|
+
<div class="jekyll_pre#{@wrapper_class}" #{@wrapper_style}#{" id='#{@id}'" if @id}>
|
|
110
111
|
#{@label}
|
|
111
112
|
<pre data-lt-active='false' class='#{classes}'#{@style} id='#{pre_id}'>#{pre_content}</pre>
|
|
112
113
|
#{attribution}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll_pre
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Slinn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
104
104
|
- !ruby/object:Gem::Version
|
|
105
105
|
version: '0'
|
|
106
106
|
requirements: []
|
|
107
|
-
rubygems_version: 3.5.
|
|
107
|
+
rubygems_version: 3.5.17
|
|
108
108
|
signing_key:
|
|
109
109
|
specification_version: 4
|
|
110
110
|
summary: Jekyll tags pre and noselect, for HTML <pre/> tag, prompts and unselectable
|