Skip to content

Commit ffa845a

Browse files
authored
docs(core): correct example code block formatting (denoland#3601)
The example for the CSP middleware looks a bit broken currently on JSR, due to the `@example` markdown is not wrapped in a code block. <img width="1136" height="247" alt="image" src="https://github.com/user-attachments/assets/57888033-aa9e-4701-87dc-4f4810365177" /> ## Changes - Improves formatting a bit, to be less compact - Wraps the example in a code block ` ```ts ` - Adds a title to the `@example` - "Basic usage" - To avoid the example being labeled as "Example1" on JSR
1 parent a801686 commit ffa845a

File tree

1 file changed

+8
-3
lines changed
  • packages/fresh/src/middlewares

1 file changed

+8
-3
lines changed

packages/fresh/src/middlewares/csp.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@ export interface CSPOptions {
1212
csp?: string[];
1313
}
1414

15-
/** Middleware to set Content-Security-Policy headers
15+
/**
16+
* Middleware to set Content-Security-Policy headers
17+
*
1618
* @param options - CSP options
17-
* @example
19+
*
20+
* @example Basic usage
21+
* ```ts
1822
* app.use(csp({
1923
* reportOnly: true,
2024
* reportTo: '/api/csp-reports',
2125
* csp: [
22-
* "script-src 'self' 'unsafe-inline' 'https://example.com'",
26+
* "script-src 'self' 'unsafe-inline' 'https://example.com'",
2327
* ],
2428
* }));
29+
* ```
2530
*/
2631
export function csp<State>(options: CSPOptions = {}): Middleware<State> {
2732
const {

0 commit comments

Comments
 (0)