accept-md 4.0.7-canary.0 → 5.0.0

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.
Files changed (2) hide show
  1. package/README.md +12 -7
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # accept-md
2
2
 
3
- CLI for [accept-md](https://github.com/slick-enterprises/accept-md): scaffold middleware and a markdown handler in your Next.js app so that requests with `Accept: text/markdown` get a markdown version of the page.
3
+ CLI for [accept-md](https://github.com/slick-enterprises/accept-md): scaffold middleware/hooks and a markdown handler in your Next.js or SvelteKit app so that requests with `Accept: text/markdown` get a markdown version of the page.
4
4
 
5
5
  ## Installation
6
6
 
@@ -29,12 +29,17 @@ pnpm add -D accept-md
29
29
 
30
30
  ### `accept-md init [path]`
31
31
 
32
- Scans your Next.js project, detects App Router vs Pages Router and middleware location, and:
33
-
34
- - Adds rewrites to `next.config.js/ts` (preferred) or creates/updates middleware to rewrite `Accept: text/markdown` to the handler
35
- - Adds the handler at `app/api/accept-md/route.ts` or `route.js` (App) or `pages/api/accept-md/index.ts` or `index.js` (Pages), depending on whether the project has TypeScript
36
- - Creates `accept-md.config.js`
37
- - Adds `accept-md-runtime` to dependencies
32
+ Scans your project, detects Next.js (App Router vs Pages Router) or SvelteKit, and:
33
+
34
+ - For **Next.js**:
35
+ - Adds rewrites to `next.config.js/ts` (preferred) or creates/updates middleware to rewrite `Accept: text/markdown` to the handler
36
+ - Adds the handler at `app/api/accept-md/route.ts` or `route.js` (App) or `pages/api/accept-md/index.ts` or `index.js` (Pages), depending on whether the project has TypeScript
37
+ - For **SvelteKit**:
38
+ - Adds a route handler at `src/routes/api/accept-md/[...path]/+server.ts` or `+server.js` (or under `routes/` if you don't use `src/`)
39
+ - Creates or wraps `src/hooks.server.ts` / `src/hooks.server.js` so `Accept: text/markdown` requests are routed to the handler
40
+ - For all frameworks:
41
+ - Creates `accept-md.config.js`
42
+ - Adds `accept-md-runtime` to dependencies
38
43
 
39
44
  **Note:** Rewrites in `next.config` are preferred over middleware for better compatibility with future Next.js versions. Middleware is still supported for backward compatibility.
40
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accept-md",
3
- "version": "4.0.7-canary.0",
3
+ "version": "5.0.0",
4
4
  "description": "CLI and init for accept-md: serve Markdown from Next.js via Accept: text/markdown",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  "README.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@accept-md/core": "4.0.7-canary.0",
46
- "accept-md-runtime": "4.0.7-canary.0"
45
+ "accept-md-runtime": "5.0.0",
46
+ "@accept-md/core": "5.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "typescript": "^5.3.0"