Skip to content

Commit bb6a56c

Browse files
committed
docs: Use @linkcode and other markdown decoration syntaxes
1 parent 0527130 commit bb6a56c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+238
-361
lines changed

browser/dom/cache.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* This function searches through the cache storage in reverse chronological order
44
* to find the most recent cached response for a given request.
55
*
6-
* > [!Note]
6+
* > [!NOTE]
77
* > Implementation inspired by Scrapbox's ServiceWorker and Cache usage pattern.
8+
* > {@see https://scrapbox.io/daiiz/ScrapboxでのServiceWorkerとCacheの活用#5d2efaffadf4e70000651173}
9+
810
*
911
* @param request The request to find a cached response for
1012
* @param options Cache query options (e.g., to ignore search params)
@@ -48,7 +50,7 @@ export const generateCacheName = (date: Date): string =>
4850
* 1. `"prefetch"` cache - temporary storage, cleared after first use
4951
* 2. `"api-yyyy-MM-dd"` cache - date-based persistent storage
5052
*
51-
* > [!Note]
53+
* > [!NOTE]
5254
* > Throws an exception if the network connection is slow
5355
*
5456
* @param urls List of API URLs to prefetch

browser/dom/cursor.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface SetPositionOptions {
1111

1212
/** Source of the cursor movement event
1313
*
14-
* "mouse" indicates the cursor was moved by mouse interaction
14+
* `"mouse"` indicates the cursor was moved by mouse interaction
1515
*/
1616
source?: "mouse";
1717
}

browser/dom/extractCodeFiles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface CodeBlock {
2828

2929
/** Lines of code within the block
3030
*
31-
* Excludes .code-title
31+
* Excludes `.code-title`
3232
*
3333
* Indentation is already removed from each line
3434
*/
@@ -54,7 +54,7 @@ export const extractCodeFiles = (
5454
startId: line.id,
5555
endId: line.id,
5656
updated: line.updated,
57-
// Register the indentation level of .code-title, not the content
57+
// Register the indentation level of `.code-title`, not the content
5858
indent: rest.indent - 1,
5959
lines: [],
6060
});

browser/dom/getCachedLines.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ let initialize: (() => void) | undefined = () => {
1010
initialize = undefined;
1111
};
1212

13-
/** Get cached version of scrapbox.Page.lines
13+
/** Get cached version of `{@linkcode https://jsr.io/@cosense/types/doc/userscript/~/Page.lines scrapbox.Page.lines}`
1414
*
15-
* This function caches the result of scrapbox.Page.lines to improve performance,
15+
* This function caches the result of `{@linkcode https://jsr.io/@cosense/types/doc/userscript/~/Page.lines scrapbox.Page.lines}` to improve performance,
1616
* as generating the lines array is computationally expensive.
1717
* The cache is automatically invalidated when the page content changes.
1818
*
19-
* @return Same as `scrapbox.Page.lines`. Always returns the latest data through cache management
19+
* @returns Same as `{@linkcode https://jsr.io/@cosense/types/doc/userscript/~/Page.lines scrapbox.Page.lines}`. Always returns the latest data through cache management
2020
*/
2121
export const getCachedLines = (): readonly Line[] | null => {
2222
initialize?.();

browser/dom/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const getText = <T extends HTMLElement>(
110110
if (value.classList.contains("char-index")) {
111111
return value.textContent ?? undefined;
112112
}
113-
// When the element contains div.lines (which contains multiple div.line elements), return all text content concatenated
113+
// When the element contains `div.lines` (which contains multiple div.line elements), return all text content concatenated
114114
if (
115115
value.classList.contains("line") ||
116116
value.getElementsByClassName("lines")?.[0]

browser/dom/open.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ export interface OpenOptions {
1414
body?: string;
1515

1616
/** Whether to open the page in a new tab
17+
* - `true`: open in a new tab
18+
* - `false`: open in the same tab
1719
*
18-
* @default false (opens in the same tab)
20+
* @default {false}
1921
*/
2022
newTab?: boolean;
2123

2224
/** Whether to reload the page when opening in the same tab
2325
*
24-
* @default false for same project (no reload), true for different project (force reload)
26+
* Default value is `false` for same project (no reload) and `true` for different project (force reload)
2527
*/
2628
reload?: boolean;
2729

browser/dom/page.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import type { Page as PageData } from "@cosense/types/rest";
33

44
export interface SetPositionOptions {
55
/** Whether to auto-scroll the page when the cursor moves outside the viewport
6-
* When true, the page will automatically scroll to keep the cursor visible
6+
* When `true`, the page will automatically scroll to keep the cursor visible
77
*
8-
* @default true
8+
* @default {true}
99
*/
1010
scrollInView?: boolean;
1111

1212
/** Source of the cursor movement event
1313
*
14-
* Can be set to "mouse" when the cursor movement is triggered by mouse interaction
14+
* Can be set to `"mouse"` when the cursor movement is triggered by mouse interaction
1515
* This parameter helps distinguish between different types of cursor movements
1616
*/
1717
source?: "mouse";
@@ -35,7 +35,8 @@ export type PageWithCache = PageData & { cachedAt: number | undefined };
3535

3636
/** Internal class for managing Scrapbox page data
3737
*
38-
* Note: Some type definitions are still in progress and may be incomplete
38+
* > [!NOTE]
39+
* > Some type definitions are still in progress and may be incomplete
3940
*/
4041
export declare class Page extends BaseStore<
4142
{ source: "mouse" | undefined } | "focusTextInput" | "scroll" | undefined

browser/dom/press.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export interface PressOptions {
1212
/** Dispatches a keyboard event programmatically via JavaScript
1313
*
1414
* Used to send keyboard input commands to Scrapbox.
15-
* Note: This function appears to block synchronously until Scrapbox's event listeners
15+
* > [!NOTE]
16+
* > This function appears to block synchronously until Scrapbox's event listeners
1617
* finish processing the keyboard event.
1718
*
1819
* @param key The name of the key to simulate pressing

browser/dom/stores.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export type { Cursor, Selection };
88
* This function accesses React's internal fiber tree to obtain references to
99
* the Cursor and Selection store instances that Scrapbox uses to manage
1010
* text input state. These stores provide APIs for:
11-
* - Cursor: Managing text cursor position and movement
12-
* - Selection: Handling text selection ranges and operations
11+
* - {@linkcode Cursor}: Managing text cursor position and movement
12+
* - {@linkcode Selection}: Handling text selection ranges and operations
1313
*
1414
* @throws {Error} If text input element or stores cannot be found
1515
* @returns Object containing cursor and selection store instances

browser/dom/takeInternalLines.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import type { BaseLine } from "@cosense/types/userscript";
44
/** Get a reference to Scrapbox's internal page content data
55
*
66
* This function provides direct access to the page content without deep cloning,
7-
* unlike `scrapbox.Page.lines` which creates a deep copy. Use this when:
7+
* unlike `{@linkcode https://jsr.io/@cosense/types/doc/userscript/~/Page.lines scrapbox.Page.lines}` which creates a deep copy. Use this when:
88
* - You need better performance by avoiding data cloning
99
* - You only need to read the raw line data
1010
*
11-
* Important Notes:
12-
* - This returns a direct reference to the internal data. While the type definition
13-
* marks it as readonly, the content can still be modified through JavaScript.
14-
* Be careful not to modify the data to avoid unexpected behavior.
15-
* - Unlike `scrapbox.Page.lines`, the returned data does not include parsed
16-
* syntax information (no syntax tree or parsed line components).
11+
* > [!IMPORTANT]
12+
* > - This returns a direct reference to the internal data. While the type definition
13+
* > marks it as readonly, the content can still be modified through JavaScript.
14+
* > Be careful not to modify the data to avoid unexpected behavior.
15+
* > - Unlike `{@linkcode https://jsr.io/@cosense/types/doc/userscript/~/Page.lines scrapbox.Page.lines}`, the returned data does not include parsed
16+
* > syntax information (no syntax tree or parsed line components).
1717
*
1818
* @returns A readonly array of BaseLine objects representing the page content
1919
*/

0 commit comments

Comments
 (0)