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
7 changes: 7 additions & 0 deletions playground/js/src/bar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/**
* @since Added in 1.2.0
*/
export interface BarOptions<NameType extends string> {
/**
* The name of the `Bar` instance.
*
* @default 'Karl'
* @since Added in 1.0.0
*/
name: NameType;
/**
Expand All @@ -27,6 +31,8 @@ export interface BarOptions<NameType extends string> {

/**
* This is a simple class called `Bar`
*
* @since Added in 1.1.0-beta.23
*/
export class Bar {
private constructor() {
Expand All @@ -38,6 +44,7 @@ export class Bar {
*
* @param {BarOptions} options
* @returns {Bar}
* @since Added in 1.0.0, 1.1.0-beta.23
*/
static create<TypeParamName extends string = 'Karl'>(options: BarOptions<TypeParamName> = {} as BarOptions<TypeParamName>): Bar {
return new Bar();
Expand Down
13 changes: 13 additions & 0 deletions playground/js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "@docusaurus/tsconfig",
"include": [
"src/**/*"
],
"compilerOptions": {
"lib": [
"es2021"
],
"target": "ES2015",
"esModuleInterop": true
}
}
6 changes: 1 addition & 5 deletions playground/website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ const config: Config = {
(context, options) =>
typedocApiPlugin(context, {
...(options as any),
projectRoot: '.',
projectRoot: '../js',
packages: [{ path: '.' }],
pythonOptions: {
moduleShortcutsPath: __dirname + '/../python/module_shortcuts.json',
pythonModulePath: __dirname + '/../python/src',
},
reexports: [
{
url: 'https://crawlee.dev/python/api/class/Dataset',
Expand Down
29 changes: 10 additions & 19 deletions src/components/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,26 @@ export function displayPartsToMarkdown(parts: JSONOutput.CommentDisplayPart[]):
.join('');
}

const ADDED_IN_TAG = '@added_in';

function getAddedInVersion(comment: JSONOutput.Comment): string | null {
const tag = comment.blockTags?.find((blockTag) => blockTag.tag === ADDED_IN_TAG);

if (!tag) {
return null;
}

return displayPartsToMarkdown(tag.content).trim() || null;
}

export function Comment({ comment, root, hideTags = [] }: CommentProps) {
if (!comment || !hasComment(comment)) {
return null;
}

// Hide custom tags.
hideTags.push('@reference');

const addedIn = getAddedInVersion(comment);
hideTags.push('@since');

const blockTags =
comment.blockTags?.filter((tag) => {
if (hideTags.includes(tag.tag)) {
return false;
}

return tag.tag !== '@default' && tag.tag !== ADDED_IN_TAG;
return tag.tag !== '@default';
}) ?? [];

return (
<div className={`tsd-comment tsd-typography ${root ? 'tsd-comment-root' : ''}`}>
{addedIn && (
<span className="badge badge--secondary tsd-added-in">Added in: {addedIn}</span>
)}

{!!comment.summary && (
<div className="lead">
<Markdown content={displayPartsToMarkdown(comment.summary)} />
Expand All @@ -89,6 +72,14 @@ export function Comment({ comment, root, hideTags = [] }: CommentProps) {
))}
</dl>
)}

{
comment.blockTags.some((tag) => tag.tag === '@since') && (
<div className="tsd-comment-since">
<Markdown content={displayPartsToMarkdown(comment.blockTags.find((tag) => tag.tag === '@since')?.content)} />
</div>
)
}
</div>
);
}
11 changes: 6 additions & 5 deletions src/components/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,17 @@ html[data-theme='light'] .tsd-panel-content {
margin-bottom: 0;
}

.tsd-comment-since {
font-style: italic;
font-size: 90%;
margin-top: 1em;
}

.tsd-comment-root {
margin-top: 0;
margin-bottom: var(--tsd-spacing-vertical-full);
}

.tsd-added-in {
display: inline-block;
margin-bottom: var(--tsd-spacing-vertical);
}

/* SOURCES */

.tsd-sources,
Expand Down
2 changes: 0 additions & 2 deletions src/plugin/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ export async function generateJson(
'@apilink',
'@doclink',
] as `@${string}`[],
// Recognize the @added_in tag (rendered as a pill) on top of the defaults.
blockTags: [...TypeDoc.OptionDefaults.blockTags, '@added_in'] as `@${string}`[],
...options.typedocOptions,
// Control how config and packages are detected
tsconfig,
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9773,9 +9773,9 @@ __metadata:
linkType: hard

"lodash@npm:^4.17.20, lodash@npm:^4.17.21":
version: 4.18.0
resolution: "lodash@npm:4.18.0"
checksum: 10/8f7f3c2013026623feb0950c2a3310427a7f3a978daedac5b9b2fb52044bb2fe38cb31e08484017f20c2297199a1ddce5c7accf8ebd108956876ce9162dedfff
version: 4.18.1
resolution: "lodash@npm:4.18.1"
checksum: 10/306fea53dfd39dad1f03d45ba654a2405aebd35797b673077f401edb7df2543623dc44b9effbb98f69b32152295fff725a4cec99c684098947430600c6af0c3f
languageName: node
linkType: hard

Expand Down
Loading