bunki 0.16.1 → 0.16.2
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 +36 -1
- package/dist/cli.js +12 -1
- package/dist/index.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,6 +124,30 @@ web-development = "Web development and technology"
|
|
|
124
124
|
new-york-city = "New York City travel guides"
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
### Internal Links (Relative Markdown Links)
|
|
128
|
+
|
|
129
|
+
Bunki automatically converts relative markdown links to absolute URLs during build time. This lets you write cross-references using familiar file paths:
|
|
130
|
+
|
|
131
|
+
**In your markdown:**
|
|
132
|
+
```markdown
|
|
133
|
+
Check out [my earlier post](../2023/introduction.md) for context.
|
|
134
|
+
|
|
135
|
+
See also [related article](../../2020/old-post.md).
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Generated HTML:**
|
|
139
|
+
```html
|
|
140
|
+
<a href="/2023/introduction/">my earlier post</a>
|
|
141
|
+
<a href="/2020/old-post/">related article</a>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This feature works with:
|
|
145
|
+
- `../YEAR/slug.md` - Single level up
|
|
146
|
+
- `../../YEAR/slug.md` - Multiple levels up
|
|
147
|
+
- Any number of `../` sequences
|
|
148
|
+
|
|
149
|
+
The links are automatically converted to absolute URLs (`/YEAR/slug/`) that match your site's URL structure.
|
|
150
|
+
|
|
127
151
|
### Business Location Data
|
|
128
152
|
|
|
129
153
|
Add structured business/location data with automatic validation:
|
|
@@ -801,6 +825,7 @@ dist/
|
|
|
801
825
|
## Features
|
|
802
826
|
|
|
803
827
|
- **Markdown Processing**: Frontmatter extraction, code highlighting, HTML sanitization
|
|
828
|
+
- **Relative Link Conversion**: Automatic conversion of relative markdown links (`../2023/post.md`) to absolute URLs (`/2023/post/`)
|
|
804
829
|
- **Frontmatter Validation**: Automatic validation of business location data with clear error messages
|
|
805
830
|
- **Security**: XSS protection, sanitized HTML, link hardening
|
|
806
831
|
- **Performance**: Static files, optional gzip, optimized output
|
|
@@ -847,7 +872,17 @@ bunki/
|
|
|
847
872
|
|
|
848
873
|
## Changelog
|
|
849
874
|
|
|
850
|
-
### v0.
|
|
875
|
+
### v0.16.0 (Current)
|
|
876
|
+
|
|
877
|
+
- **Relative Link Conversion**: Automatically convert relative markdown links to absolute URLs
|
|
878
|
+
- Supports `../2023/post.md` → `/2023/post/` conversion during build time
|
|
879
|
+
- Works with multiple parent directories (`../../`, `../../../`, etc.)
|
|
880
|
+
- Preserves link text and formatting
|
|
881
|
+
- Enables cleaner internal cross-references in markdown files
|
|
882
|
+
- **Comprehensive Testing**: Added 13 new tests for relative link conversion
|
|
883
|
+
- **Zero Configuration**: Works automatically without any setup required
|
|
884
|
+
|
|
885
|
+
### v0.15.0
|
|
851
886
|
|
|
852
887
|
- **Frontmatter Validation**: Automatic validation of business location data
|
|
853
888
|
- Enforces `business:` field (rejects deprecated `location:`)
|
package/dist/cli.js
CHANGED
|
@@ -32959,6 +32959,11 @@ function createMarked(cdnConfig) {
|
|
|
32959
32959
|
walkTokens(token) {
|
|
32960
32960
|
if (token.type === "link") {
|
|
32961
32961
|
token.href = token.href || "";
|
|
32962
|
+
let relativeMatch = token.href.match(/^(\.\.\/)+(\d{4})\/([a-zA-Z0-9_-]+?)(?:\.md)?(?:\/)?$/);
|
|
32963
|
+
if (relativeMatch) {
|
|
32964
|
+
const [, , year, slug] = relativeMatch;
|
|
32965
|
+
token.href = `/${year}/${slug}/`;
|
|
32966
|
+
}
|
|
32962
32967
|
const isExternal = token.href && (token.href.startsWith("http://") || token.href.startsWith("https://") || token.href.startsWith("//"));
|
|
32963
32968
|
if (isExternal) {
|
|
32964
32969
|
token.isExternalLink = true;
|
|
@@ -35314,6 +35319,12 @@ function registerValidateCommand(program2) {
|
|
|
35314
35319
|
}
|
|
35315
35320
|
|
|
35316
35321
|
// src/cli.ts
|
|
35322
|
+
import { readFileSync } from "fs";
|
|
35323
|
+
import { join, dirname } from "path";
|
|
35324
|
+
import { fileURLToPath } from "url";
|
|
35325
|
+
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
35326
|
+
var packageJson = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
|
|
35327
|
+
var VERSION = packageJson.version;
|
|
35317
35328
|
var program2 = new Command;
|
|
35318
35329
|
registerInitCommand(program2);
|
|
35319
35330
|
registerNewCommand(program2);
|
|
@@ -35322,7 +35333,7 @@ registerServeCommand(program2);
|
|
|
35322
35333
|
registerCssCommand(program2);
|
|
35323
35334
|
registerImagesPushCommand(program2);
|
|
35324
35335
|
registerValidateCommand(program2);
|
|
35325
|
-
program2.name("bunki").description("An opinionated static site generator built with Bun").version(
|
|
35336
|
+
program2.name("bunki").description("An opinionated static site generator built with Bun").version(VERSION);
|
|
35326
35337
|
var currentFile = import.meta.url.replace("file://", "");
|
|
35327
35338
|
var mainFile = Bun.main;
|
|
35328
35339
|
if (currentFile === mainFile || currentFile.endsWith(mainFile)) {
|
package/dist/index.js
CHANGED
|
@@ -30577,6 +30577,11 @@ function createMarked(cdnConfig) {
|
|
|
30577
30577
|
walkTokens(token) {
|
|
30578
30578
|
if (token.type === "link") {
|
|
30579
30579
|
token.href = token.href || "";
|
|
30580
|
+
let relativeMatch = token.href.match(/^(\.\.\/)+(\d{4})\/([a-zA-Z0-9_-]+?)(?:\.md)?(?:\/)?$/);
|
|
30581
|
+
if (relativeMatch) {
|
|
30582
|
+
const [, , year, slug] = relativeMatch;
|
|
30583
|
+
token.href = `/${year}/${slug}/`;
|
|
30584
|
+
}
|
|
30580
30585
|
const isExternal = token.href && (token.href.startsWith("http://") || token.href.startsWith("https://") || token.href.startsWith("//"));
|
|
30581
30586
|
if (isExternal) {
|
|
30582
30587
|
token.isExternalLink = true;
|
package/package.json
CHANGED