Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,9 @@ export interface ParamMatcher {
}

/**
* A function exported from an endpoint that corresponds to an
* HTTP verb (`get`, `put`, `patch`, etc) and handles requests with
* that method. Note that since 'delete' is a reserved word in
* JavaScript, delete handles are called `del` instead.
* A `(event: RequestEvent) => RequestHandlerOutput` function exported from an endpoint that corresponds to an HTTP verb (`get`, `put`, `patch`, etc) and handles requests with that method. Note that since 'delete' is a reserved word in JavaScript, delete handles are called `del` instead.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make a similar change to the description of Load to make it easier to read sans generics as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, we can, i just figured we should get the plumbing in first and then make the actual changes separately (apart from this one for demo purposes) rather than worrying about all the content changes straight away

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the only other one we might consider to changing from a quick skim though I did earlier, so figured we might as well just get it out of the way. Anyway, this change looks good to me

*
* Note that you can use [generated types](/docs/types#generated-types)
* instead of manually specifying the `Params` generic argument.
* Note that you can use [generated types](/docs/types#generated-types) instead of manually specifying the `Params` generic argument.
*/
export interface RequestHandler<
Params extends Record<string, string> = Record<string, string>,
Expand Down
19 changes: 16 additions & 3 deletions sites/kit.svelte.dev/src/lib/docs/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ export async function read_file(dir, file) {
.join('');
}
);
},
codespan: (text) => {
return (
'<code>' +
text.replace(type_regex, (match, prefix, name) => {
const link = `<a href="${type_links.get(name)}">${name}</a>`;
return `${prefix || ''}${link}`;
}) +
'</code>'
);
}
});

Expand Down Expand Up @@ -241,7 +251,8 @@ export function read_headings(dir) {
file,
// gross hack to accommodate FAQ
slug: dir === 'faq' ? slug : undefined,
code: () => ''
code: () => '',
codespan: () => ''
});

return {
Expand All @@ -259,9 +270,10 @@ export function read_headings(dir) {
* file: string;
* slug: string;
* code: (source: string, language: string, current: string) => string;
* codespan: (source: string) => string;
* }} opts
*/
function parse({ body, file, slug, code }) {
function parse({ body, file, slug, code, codespan }) {
const headings = slug ? [slug] : [];
const sections = [];

Expand Down Expand Up @@ -307,7 +319,8 @@ function parse({ body, file, slug, code }) {

return `<h${level} id="${slug}">${html}<a href="#${slug}" class="anchor"><span class="visually-hidden">permalink</span></a></h${level}>`;
},
code: (source, language) => code(source, language, current)
code: (source, language) => code(source, language, current),
codespan
});

return {
Expand Down