@anyblades/eleventy-blades 0.28.0-beta.4 → 0.29.0-alpha
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.
- package/README.md +59 -67
- package/package.json +1 -1
- package/src/do/package.json +3 -6
- package/src/eleventy.config.js +3 -6
- package/src/filters/attr_concat.js +2 -2
- package/src/filters/attr_includes.js +1 -1
- package/src/filters/attr_set.js +1 -1
- package/src/filters/remove_tag.js +1 -1
- package/src/filters/strip_tag.js +1 -1
- package/src/processors/markdown.js +1 -1
- /package/{LICENSE → LICENSE.md} +0 -0
package/README.md
CHANGED
|
@@ -1,62 +1,57 @@
|
|
|
1
|
-
# 🥷 *Eleventy Bl*ades
|
|
2
|
-
|
|
3
1
|
<!--section:summary-->
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# Eleventy 🥷 *Bl*ades
|
|
4
|
+
|
|
5
|
+
<big>Ultimate blade kit for 11ty (Build Awesome).</big>
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
[](https://github.com/anyblades/eleventy-blades)
|
|
9
9
|
[](https://github.com/anyblades/eleventy-blades)
|
|
10
10
|
|
|
11
|
-
<!--section:
|
|
12
|
-
|
|
13
|
-
## [Documentation](https://blades.ninja/build-awesome-11ty/)
|
|
14
|
-
|
|
15
|
-
### [Filters
|
|
16
|
-
|
|
17
|
-
<!--
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
- [Base npm scripts](https://blades.ninja/build-awesome-11ty/tools/#base-scripts) <!--{data-marker=🥷}-->
|
|
50
|
-
- [Data helpers](https://blades.ninja/build-awesome-11ty/tools/#data-helpers)
|
|
51
|
-
- [Blades starters](https://blades.ninja/build-awesome-11ty/tools/#starters) <!--{data-marker=🥷}-->
|
|
52
|
-
|
|
53
|
-
<!--{.columns}-->
|
|
11
|
+
<!--section:gh-only-->
|
|
12
|
+
|
|
13
|
+
## [Documentation ↗](https://blades.ninja/build-awesome-11ty/)
|
|
14
|
+
|
|
15
|
+
### [Filters](https://blades.ninja/build-awesome-11ty/filters/)
|
|
16
|
+
|
|
17
|
+
<!-- ToC from https://blades.ninja/build-awesome-11ty/#filters -->
|
|
18
|
+
<ul class="columns"><li><a href="https://blades.ninja/build-awesome-11ty/filters/#attr-concat" tabindex="-1">attr_concat</a></li><p></p>
|
|
19
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#attr-includes" tabindex="-1">attr_includes</a></li>
|
|
20
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#attr-set" tabindex="-1">attr_set</a></li>
|
|
21
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#date" tabindex="-1">date</a></li>
|
|
22
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#fetch" tabindex="-1">fetch</a></li>
|
|
23
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#if" tabindex="-1">if</a></li>
|
|
24
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#markdownify" tabindex="-1">markdownify</a></li>
|
|
25
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#merge" tabindex="-1">merge</a></li>
|
|
26
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#remove-tag" tabindex="-1">remove_tag</a></li>
|
|
27
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#section" tabindex="-1">section</a></li>
|
|
28
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#strip-tag" tabindex="-1">strip_tag</a></li>
|
|
29
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#unindent" tabindex="-1">unindent</a></li>
|
|
30
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/filters/#install" tabindex="-1">Install</a></li></ul>
|
|
31
|
+
|
|
32
|
+
### [Processors](https://blades.ninja/build-awesome-11ty/processors/)
|
|
33
|
+
|
|
34
|
+
<!-- ToC from https://blades.ninja/build-awesome-11ty/#processors -->
|
|
35
|
+
<ul class="columns"><li><a href="https://blades.ninja/build-awesome-11ty/processors/#auto-link-favicons" tabindex="-1">autoLinkFavicons postprocessor (transformer)</a></li><p></p>
|
|
36
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/processors/#md-auto-raw" tabindex="-1">mdAutoRawTags preprocessor</a></li>
|
|
37
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/processors/#md-auto-br" tabindex="-1">mdAutoNl2br converter</a></li>
|
|
38
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/processors/#md-hidden-attrs" tabindex="-1">Hidden Markdown attributes using HTML comments</a></li>
|
|
39
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/processors/#install" tabindex="-1">Install</a></li></ul>
|
|
40
|
+
|
|
41
|
+
### [Power tools](https://blades.ninja/build-awesome-11ty/tools/)
|
|
42
|
+
|
|
43
|
+
<!-- ToC from https://blades.ninja/build-awesome-11ty/#tools -->
|
|
44
|
+
<ul class="columns"><li><a href="https://blades.ninja/build-awesome-11ty/tools/#starters" tabindex="-1">Modern starters</a></li><p></p>
|
|
45
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/tools/#base-config" tabindex="-1">Base eleventy.config.js</a></li>
|
|
46
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/tools/#base-scripts" tabindex="-1">Base 11ty npm scripts via npm workspace</a></li>
|
|
47
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/tools/#data-helpers" tabindex="-1">Data helpers</a></li>
|
|
48
|
+
<li><a href="https://blades.ninja/build-awesome-11ty/tools/#more" tabindex="-1">More</a><ul><li><a href="https://blades.ninja/build-awesome-11ty/tools/#find-and-kill-11ty-processes" tabindex="-1">Find and kill 11ty processes</a></li></ul></li></ul>
|
|
54
49
|
|
|
55
50
|
---
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
<!--section:install-->
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
## Install
|
|
60
55
|
|
|
61
56
|
```sh
|
|
62
57
|
npm install @anyblades/eleventy-blades
|
|
@@ -64,7 +59,7 @@ npm install @anyblades/eleventy-blades
|
|
|
64
59
|
|
|
65
60
|
Then choose one of the following options:
|
|
66
61
|
|
|
67
|
-
<mark>A. All-in</mark> managed by Eleventy Blades:
|
|
62
|
+
###### <mark>A. All-in</mark> managed by Eleventy Blades:
|
|
68
63
|
|
|
69
64
|
Consider symlinking entire `eleventy.config.js` as a set-and-forget zero-config zero-maintenance solution:
|
|
70
65
|
|
|
@@ -79,7 +74,7 @@ Living examples:
|
|
|
79
74
|
- https://github.com/anyblades/build-awesome-starter
|
|
80
75
|
- https://github.com/anyblades/bladeswitch
|
|
81
76
|
|
|
82
|
-
<mark>B. Base config</mark> by Eleventy Blades with
|
|
77
|
+
###### <mark>B. Base config</mark> by Eleventy Blades with overrides in `eleventy.config.js`:
|
|
83
78
|
|
|
84
79
|
```js
|
|
85
80
|
import baseConfig from "@anyblades/eleventy-blades/base-config";
|
|
@@ -92,9 +87,9 @@ export default function (eleventyConfig) {
|
|
|
92
87
|
}
|
|
93
88
|
```
|
|
94
89
|
|
|
95
|
-
Living example: https://github.com/
|
|
90
|
+
Living example: https://github.com/johnheenan/minform/blob/main/eleventy.config.js
|
|
96
91
|
|
|
97
|
-
<mark>C. Plug-in</mark> Eleventy Blades in
|
|
92
|
+
###### <mark>C. Plug-in</mark> Eleventy Blades in existing `eleventy.config.js`:
|
|
98
93
|
|
|
99
94
|
```js
|
|
100
95
|
import eleventyBladesPlugin from "@anyblades/eleventy-blades";
|
|
@@ -110,7 +105,7 @@ export default function (eleventyConfig) {
|
|
|
110
105
|
}
|
|
111
106
|
```
|
|
112
107
|
|
|
113
|
-
<mark>D. Individual imports</mark> from Eleventy Blades in
|
|
108
|
+
###### <mark>D. Individual imports</mark> from Eleventy Blades in `eleventy.config.js`:
|
|
114
109
|
|
|
115
110
|
```js
|
|
116
111
|
import { siteData, mdAutoRawTags, mdAutoNl2br, autoLinkFavicons, attrSetFilter, attrConcatFilter, ... } from "@anyblades/eleventy-blades";
|
|
@@ -126,26 +121,23 @@ export default function (eleventyConfig) {
|
|
|
126
121
|
}
|
|
127
122
|
```
|
|
128
123
|
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
Or use a <mark>fully preconfigured template</mark> as an alternative option:
|
|
132
|
-
|
|
133
|
-
<nav>
|
|
134
|
-
|
|
135
|
-
[🥷 Build Awesome Starter ↗ <small style="white-space: nowrap">11ty + Tailwind + Typography + Blades</small>](https://github.com/anyblades/build-awesome-starter)<!--{role=button .outline}-->
|
|
136
|
-
|
|
137
|
-
[🥷 Bladeswitch Starter ↗ <small style="white-space: nowrap">11ty + Pico + Blades</small>](https://github.com/anyblades/bladeswitch)<!--{role=button .outline}-->
|
|
124
|
+
###### <mark>E. Included with</mark>
|
|
138
125
|
|
|
139
|
-
|
|
126
|
+
- https://github.com/anyblades/build-awesome-starter
|
|
127
|
+
- https://github.com/anyblades/bladeswitch starter
|
|
128
|
+
- https://github.com/johnheenan/minform starter
|
|
129
|
+
- https://github.com/hostfurl/minformhf starter
|
|
140
130
|
|
|
141
|
-
<!--section:
|
|
131
|
+
<!--section:featured-->
|
|
142
132
|
|
|
143
133
|
---
|
|
144
134
|
|
|
145
|
-
Featured by
|
|
135
|
+
## <sup>Featured by</sup><!--A-Z-->
|
|
146
136
|
|
|
147
|
-
- https://11tybundle.dev/blog/11ty-bundle-88/
|
|
148
137
|
- https://11tybundle.dev/blog/11ty-bundle-83/
|
|
138
|
+
- https://11tybundle.dev/blog/11ty-bundle-88/
|
|
149
139
|
- https://11tybundle.dev/categories/getting-started/
|
|
150
|
-
- https://hamatti.org/posts/markdown-content-split-to-sections-in-eleventy-and-nunjucks/#:~:text=anydigital
|
|
151
140
|
- https://github.com/anydigital/awesome-11ty-build-awesome
|
|
141
|
+
- https://hamatti.org/posts/markdown-content-split-to-sections-in-eleventy-and-nunjucks/#:~:text=anydigital
|
|
142
|
+
|
|
143
|
+
<!--{.unlist .columns}-->
|
package/package.json
CHANGED
package/src/do/package.json
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
"name": "@anyblades/eleventy-blades-do",
|
|
3
3
|
"private": true,
|
|
4
4
|
"scripts": {
|
|
5
|
-
"
|
|
6
|
-
"start": "npm run 11ty -- $ELTY_OPTIONS --serve --incremental & npm run tw -- --watch",
|
|
7
|
-
"prerestart": "npm run 11ty:clean",
|
|
5
|
+
"start": "npm run 11ty -- $ELTY_OPTIONS --serve --incremental & npm run tw -- $TW_OPTIONS --watch",
|
|
8
6
|
"stage": "npm run 11ty:clean; npm run build && serve ../_site",
|
|
7
|
+
"build": "npm run tw -- $TW_OPTIONS && npm run 11ty -- $ELTY_OPTIONS",
|
|
9
8
|
"11ty": "cd ../ && NODE_OPTIONS='--preserve-symlinks' eleventy",
|
|
10
9
|
"11ty:clean": "rm -r ../_site",
|
|
11
|
-
"
|
|
12
|
-
"tw": "cd ../ && tailwindcss -i ./_styles/styles.css -o ./_public/styles.css",
|
|
13
|
-
"tw:debug": "DEBUG=* npm run tw --"
|
|
10
|
+
"tw": "cd ../ && tailwindcss"
|
|
14
11
|
}
|
|
15
12
|
}
|
package/src/eleventy.config.js
CHANGED
|
@@ -95,9 +95,9 @@ export default function (eleventyConfig) {
|
|
|
95
95
|
});
|
|
96
96
|
if (pluginTOC) {
|
|
97
97
|
eleventyConfig.addPlugin(pluginTOC, {
|
|
98
|
-
ignoredElements: ["
|
|
98
|
+
ignoredElements: [".header-anchor", "sub"],
|
|
99
99
|
ul: true,
|
|
100
|
-
wrapper: (toc) =>
|
|
100
|
+
wrapper: (toc) => `${toc}`,
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
// https://www.11ty.dev/docs/plugins/rss/#virtual-template
|
|
@@ -128,10 +128,7 @@ export default function (eleventyConfig) {
|
|
|
128
128
|
if (markdownItAnchor) {
|
|
129
129
|
md = md.use(markdownItAnchor, {
|
|
130
130
|
slugify: slugify, // @TODO: TRICKS
|
|
131
|
-
permalink: markdownItAnchor.permalink.ariaHidden(
|
|
132
|
-
class: null,
|
|
133
|
-
renderAttrs: () => ({ "data-is-anchor": true }),
|
|
134
|
-
}),
|
|
131
|
+
permalink: markdownItAnchor.permalink.ariaHidden(),
|
|
135
132
|
});
|
|
136
133
|
}
|
|
137
134
|
if (markdownItAttrs) md = md.use(markdownItAttrs);
|
|
@@ -80,13 +80,13 @@ A filter that concatenates values to an attribute array, returning a new object
|
|
|
80
80
|
- Logs an error if the existing attribute is not an array
|
|
81
81
|
- `TBC:` Supports nested attributes (e.g., `data.tags`)
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
##### Example: Add tags to a post object in `.njk`:
|
|
84
84
|
|
|
85
85
|
```jinja2
|
|
86
86
|
{% set enhancedPost = post | attr_concat('tags', ['featured', 'popular']) %}
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
##### `PRO` Example: Add scripts and styles to the `site` object in `.liquid`:
|
|
90
90
|
|
|
91
91
|
```liquid
|
|
92
92
|
{% capture _ %}[
|
|
@@ -53,7 +53,7 @@ A filter that filters a list of items by checking if an attribute array includes
|
|
|
53
53
|
|
|
54
54
|
**Why use this?** When working with Eleventy collections, you often need to filter items based on tags or other array attributes in front matter. The `attr_includes` filter provides a flexible way to filter by any array attribute, with support for nested properties using dot notation.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
##### Example: Get all posts that include `#javascript` tag
|
|
57
57
|
|
|
58
58
|
```jinja2 {data-caption="in .njk:"}
|
|
59
59
|
{% set js_posts = collections.all | attr_includes('data.tags', '#javascript') %}
|
package/src/filters/attr_set.js
CHANGED
|
@@ -33,7 +33,7 @@ export function attrSetFilter(eleventyConfig) {
|
|
|
33
33
|
|
|
34
34
|
A filter that creates a new object with an overridden attribute value. This is useful for modifying data objects in templates without mutating the original. Or even constructing an object from scratch.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
##### Example: How to pass object(s) as argument(s) to a filter in `.liquid`?
|
|
37
37
|
|
|
38
38
|
```liquid {data-caption="trick for '| renderContent' filter"}
|
|
39
39
|
{% assign _ctx = null | attr_set: 'collections', collections %}
|
|
@@ -60,7 +60,7 @@ A filter that removes a specified HTML element from provided HTML content. It re
|
|
|
60
60
|
|
|
61
61
|
**Security note:** While this filter can help sanitize HTML content, it should not be relied upon as the sole security measure. For critical security requirements, use a dedicated HTML sanitization library on the server side before content reaches your templates.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
##### Example: Remove all script tags from content <!-- @TODO: better examples -->
|
|
64
64
|
|
|
65
65
|
```jinja2
|
|
66
66
|
{% set cleanContent = htmlContent | remove_tag('script') %}
|
package/src/filters/strip_tag.js
CHANGED
|
@@ -57,7 +57,7 @@ A filter that strips a specified HTML element from content while keeping its inn
|
|
|
57
57
|
- Case-insensitive matching
|
|
58
58
|
- Non-destructive: Returns a new string, leaves the original unchanged
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
##### Example: Unwrap a wrapping `<div>` from content
|
|
61
61
|
|
|
62
62
|
```jinja2
|
|
63
63
|
{% set unwrapped = htmlContent | strip_tag('div') %}
|
|
@@ -47,7 +47,7 @@ export function transformNl2br(content) {
|
|
|
47
47
|
}
|
|
48
48
|
/*```
|
|
49
49
|
|
|
50
|
-
### Hidden Markdown attributes using HTML comments
|
|
50
|
+
### Hidden Markdown attributes using HTML comments <sub>`<!--{...}-—>` trick via `mdAutoUncommentAttrs` converter</sub> {#md-hidden-attrs}
|
|
51
51
|
|
|
52
52
|
This function amends the markdown library to automatically expand
|
|
53
53
|
HTML-comment-wrapped attribute blocks `<!—-{...}-->` to their raw form
|
/package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|