@kirigami/php-prepros 1.9.0 → 1.9.1
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 +13 -0
- package/package.json +1 -1
- package/src/libraries/md.plugins.php +10 -1
package/README.md
CHANGED
|
@@ -109,6 +109,19 @@ Part of the **Kirigami** project ecosystem.
|
|
|
109
109
|
|
|
110
110
|
---
|
|
111
111
|
|
|
112
|
+
## What's new in 1.9.1
|
|
113
|
+
|
|
114
|
+
- **`{% img-asset %}` no longer crashes the build on an unresolvable path.**
|
|
115
|
+
`IMG::asset()`'s exception is now caught and turned into an HTML comment,
|
|
116
|
+
matching `codepen`/`checklist`'s own missing-argument behavior instead of
|
|
117
|
+
aborting the whole render. This also makes it safe to *document* the tag —
|
|
118
|
+
a literal `` `{% img-asset path … %}` `` written as prose inside a code
|
|
119
|
+
span still runs the plugin (code-span protection only swaps the *displayed*
|
|
120
|
+
output back to the literal text; the callback itself always executes), so
|
|
121
|
+
a placeholder path used to throw "Invalid image file." and fail the build.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
112
125
|
## What's new in 1.9.0
|
|
113
126
|
|
|
114
127
|
- **`{% youtube %}` removed** — moved to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirigami/php-prepros",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "PHP preprocessor for the Kirigami static site generator. Compile PHP page templates to clean, deployable HTML — with zero server dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kirigami",
|
|
@@ -89,6 +89,15 @@ MD::registerPlugin('img-asset', function (array $args, string $body): string {
|
|
|
89
89
|
$height = isset($args[2]) ? (int) $args[2] : 0;
|
|
90
90
|
$cover = isset($args[3]) && strtolower($args[3]) === 'cover';
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
// A resolvable path is required to actually call IMG::asset() — this
|
|
93
|
+
// also protects a literal `{% img-asset path … %}` written as Markdown
|
|
94
|
+
// *documentation* (inside a code span): the plugin still runs even when
|
|
95
|
+
// its output ends up discarded for the literal text, so a placeholder
|
|
96
|
+
// path must not throw.
|
|
97
|
+
try {
|
|
98
|
+
$src = IMG::asset($path, $width, $height, $cover, PREPROS::$file);
|
|
99
|
+
} catch (Throwable $e) {
|
|
100
|
+
return '<!-- img-asset: ' . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . ' -->';
|
|
101
|
+
}
|
|
93
102
|
return '<img src="' . htmlspecialchars($src, ENT_QUOTES, 'UTF-8') . '" alt="">';
|
|
94
103
|
});
|