docmedown 0.1.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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +277 -0
  3. package/bin/docmedown.js +2 -0
  4. package/dist/cli.js +1053 -0
  5. package/dist/docmedown.cjs +356 -0
  6. package/dist/docmedown.iife.js +356 -0
  7. package/dist/docmedown.mjs +33543 -0
  8. package/dist/types/runtime/app.d.ts +9 -0
  9. package/dist/types/runtime/components/Builtins.d.ts +44 -0
  10. package/dist/types/runtime/components/Content.d.ts +2 -0
  11. package/dist/types/runtime/components/DmdRegistry.d.ts +17 -0
  12. package/dist/types/runtime/components/Layout.d.ts +2 -0
  13. package/dist/types/runtime/components/Navbar.d.ts +2 -0
  14. package/dist/types/runtime/components/Sidebar.d.ts +2 -0
  15. package/dist/types/runtime/components/TableOfContents.d.ts +8 -0
  16. package/dist/types/runtime/config.d.ts +14 -0
  17. package/dist/types/runtime/index.d.ts +6 -0
  18. package/dist/types/runtime/loader/auto-indexer.d.ts +3 -0
  19. package/dist/types/runtime/loader/local-loader.d.ts +11 -0
  20. package/dist/types/runtime/loader/remote-github.d.ts +10 -0
  21. package/dist/types/runtime/loader/remote-gitlab.d.ts +9 -0
  22. package/dist/types/runtime/markdown/callouts.d.ts +17 -0
  23. package/dist/types/runtime/markdown/highlighter.d.ts +19 -0
  24. package/dist/types/runtime/markdown/katex.d.ts +1 -0
  25. package/dist/types/runtime/markdown/mermaid.d.ts +1 -0
  26. package/dist/types/runtime/markdown/parser.d.ts +17 -0
  27. package/dist/types/runtime/markdown/renderer.d.ts +7 -0
  28. package/dist/types/runtime/provider/DocProvider.d.ts +38 -0
  29. package/dist/types/runtime/provider/ThemeProvider.d.ts +18 -0
  30. package/dist/types/runtime/router.d.ts +23 -0
  31. package/dist/types/runtime/search/SearchModal.d.ts +11 -0
  32. package/dist/types/runtime/search/search-index.d.ts +9 -0
  33. package/dist/types/runtime/types.d.ts +165 -0
  34. package/package.json +110 -0
  35. package/templates/.dmd/components.js +25 -0
  36. package/templates/README.md +68 -0
  37. package/templates/docs.json +25 -0
  38. package/templates/getting-started.md +64 -0
  39. package/templates/guides/custom-components.md +78 -0
  40. package/templates/index.html +19 -0
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { DocConfig } from './types';
3
+ import './styles/main.css';
4
+ interface DocMeDownAppProps {
5
+ config: DocConfig;
6
+ basePath?: string;
7
+ }
8
+ export declare const DocMeDownApp: React.FC<DocMeDownAppProps>;
9
+ export {};
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ export interface TabsProps {
3
+ children?: React.ReactNode;
4
+ defaultIndex?: number;
5
+ groupId?: string;
6
+ }
7
+ export interface TabItemProps {
8
+ label: string;
9
+ value?: string;
10
+ icon?: React.ReactNode;
11
+ children: React.ReactNode;
12
+ }
13
+ export declare const Tabs: React.FC<TabsProps>;
14
+ export declare const Tab: React.FC<TabItemProps>;
15
+ export interface CardProps {
16
+ title: string;
17
+ description?: string;
18
+ href?: string;
19
+ icon?: React.ReactNode | string;
20
+ badge?: string;
21
+ badgeType?: 'info' | 'success' | 'warning' | 'new';
22
+ children?: React.ReactNode;
23
+ }
24
+ export declare const Card: React.FC<CardProps>;
25
+ export interface CardGridProps {
26
+ cols?: 1 | 2 | 3 | 4;
27
+ children: React.ReactNode;
28
+ }
29
+ export declare const CardGrid: React.FC<CardGridProps>;
30
+ export interface BadgeProps {
31
+ type?: 'info' | 'success' | 'warning' | 'danger' | 'new';
32
+ children: React.ReactNode;
33
+ }
34
+ export declare const Badge: React.FC<BadgeProps>;
35
+ export interface StepsProps {
36
+ children: React.ReactNode;
37
+ }
38
+ export declare const Steps: React.FC<StepsProps>;
39
+ export interface StepProps {
40
+ title: string;
41
+ step?: number;
42
+ children: React.ReactNode;
43
+ }
44
+ export declare const Step: React.FC<StepProps>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Content: React.FC;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export type ComponentMap = Record<string, React.ComponentType<any>>;
3
+ export declare class ComponentRegistry {
4
+ private static instance;
5
+ private components;
6
+ private constructor();
7
+ static getInstance(): ComponentRegistry;
8
+ private checkGlobalComponents;
9
+ register(name: string, component: React.ComponentType<any>): void;
10
+ registerMultiple(map: ComponentMap): void;
11
+ get(name: string): React.ComponentType<any> | undefined;
12
+ getAll(): ComponentMap;
13
+ /**
14
+ * Dynamically loads custom components from .dmd/components.js if available
15
+ */
16
+ loadDmdDirectory(basePath?: string): Promise<void>;
17
+ }
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Layout: React.FC;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Navbar: React.FC;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Sidebar: React.FC;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { DocHeading } from '../types';
3
+ interface TOCProps {
4
+ headings: DocHeading[];
5
+ currentSlug: string;
6
+ }
7
+ export declare const TableOfContents: React.FC<TOCProps>;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DocConfig } from './types';
2
+ export declare const DEFAULT_CONFIG: DocConfig;
3
+ /**
4
+ * Normalizes and merges user config with defaults
5
+ */
6
+ export declare function normalizeConfig(userConfig?: Partial<DocConfig>): DocConfig;
7
+ /**
8
+ * Attempts to load config from:
9
+ * 1. window.__DOCMEDOWN_CONFIG__
10
+ * 2. <script id="dmd-config" type="application/json">
11
+ * 3. Fetching docs.json / dmd.json relative to the base
12
+ * 4. Falling back to intelligent defaults
13
+ */
14
+ export declare function loadDocConfig(basePath?: string): Promise<DocConfig>;
@@ -0,0 +1,6 @@
1
+ import { DocMeDownInitOptions, DocMeDownInstance } from './types';
2
+ export { DocMeDownApp } from './app';
3
+ export { loadDocConfig } from './config';
4
+ export * from './types';
5
+ export * from './components/Builtins';
6
+ export declare function initDocMeDown(options?: DocMeDownInitOptions): Promise<DocMeDownInstance | null>;
@@ -0,0 +1,3 @@
1
+ import { SidebarTreeNode, SidebarItemConfig, DocFrontmatter } from '../types';
2
+ export declare function formatTitleFromFilename(name: string): string;
3
+ export declare function buildSidebarTree(files: string[], frontmatters?: Record<string, DocFrontmatter>, manualSidebar?: SidebarItemConfig[]): SidebarTreeNode[];
@@ -0,0 +1,11 @@
1
+ import { DocManifest } from '../types';
2
+ export declare class LocalDocLoader {
3
+ private embeddedManifest;
4
+ private cache;
5
+ constructor();
6
+ private checkEmbeddedData;
7
+ getEmbeddedManifest(): DocManifest | null;
8
+ fetchManifest(basePath?: string): Promise<DocManifest | null>;
9
+ fetchDocContent(slug: string, basePath?: string): Promise<string | null>;
10
+ private normalizeKey;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { RemoteSourceConfig } from '../types';
2
+ export declare class RemoteGithubLoader {
3
+ private config;
4
+ private cache;
5
+ private treeCache;
6
+ constructor(config: RemoteSourceConfig);
7
+ private getHeaders;
8
+ discoverFiles(): Promise<string[]>;
9
+ fetchDocContent(slug: string): Promise<string | null>;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { RemoteSourceConfig } from '../types';
2
+ export declare class RemoteGitlabLoader {
3
+ private config;
4
+ private cache;
5
+ constructor(config: RemoteSourceConfig);
6
+ private getHeaders;
7
+ discoverFiles(): Promise<string[]>;
8
+ fetchDocContent(slug: string): Promise<string | null>;
9
+ }
@@ -0,0 +1,17 @@
1
+ export interface CalloutInfo {
2
+ type: 'note' | 'tip' | 'important' | 'warning' | 'caution';
3
+ title: string;
4
+ content: string;
5
+ }
6
+ export declare const CALLOUT_ICONS: {
7
+ note: string;
8
+ tip: string;
9
+ important: string;
10
+ warning: string;
11
+ caution: string;
12
+ };
13
+ /**
14
+ * Transforms GitHub alert blockquotes into DocMeDown callouts
15
+ * e.g. > [!NOTE] or > [!WARNING] Title
16
+ */
17
+ export declare function processAlerts(markdown: string): string;
@@ -0,0 +1,19 @@
1
+ import 'prismjs/components/prism-clike';
2
+ import 'prismjs/components/prism-javascript';
3
+ import 'prismjs/components/prism-typescript';
4
+ import 'prismjs/components/prism-jsx';
5
+ import 'prismjs/components/prism-tsx';
6
+ import 'prismjs/components/prism-bash';
7
+ import 'prismjs/components/prism-json';
8
+ import 'prismjs/components/prism-yaml';
9
+ import 'prismjs/components/prism-css';
10
+ import 'prismjs/components/prism-markdown';
11
+ import 'prismjs/components/prism-python';
12
+ import 'prismjs/components/prism-rust';
13
+ import 'prismjs/components/prism-go';
14
+ import 'prismjs/components/prism-sql';
15
+ import 'prismjs/components/prism-docker';
16
+ import 'prismjs/components/prism-diff';
17
+ export declare function highlightCode(code: string, lang?: string): string;
18
+ export declare function escapeHtml(str: string): string;
19
+ export declare function renderCodeBlock(code: string, infoString?: string): string;
@@ -0,0 +1 @@
1
+ export declare function renderMath(content: string): string;
@@ -0,0 +1 @@
1
+ export declare function renderMermaidDiagrams(): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import { DocFrontmatter, DocHeading } from '../types';
2
+ export interface ParsedMarkdown {
3
+ frontmatter: DocFrontmatter;
4
+ html: string;
5
+ headings: DocHeading[];
6
+ readingTimeMinutes: number;
7
+ }
8
+ /**
9
+ * Extracts YAML frontmatter without external runtime dependencies for browser friendliness
10
+ */
11
+ export declare function extractFrontmatter(rawMarkdown: string): {
12
+ frontmatter: DocFrontmatter;
13
+ content: string;
14
+ };
15
+ export declare function slugifyHeading(text: string): string;
16
+ export declare function calculateReadingTime(text: string): number;
17
+ export declare function parseMarkdown(rawContent: string, currentSlug?: string): ParsedMarkdown;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface MarkdownRendererProps {
3
+ html: string;
4
+ onNavigate?: (slug: string, anchor: string) => void;
5
+ }
6
+ export declare const MarkdownRenderer: React.FC<MarkdownRendererProps>;
7
+ export {};
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { DocConfig, SidebarTreeNode } from '../types';
3
+ import { HashRouter } from '../router';
4
+ import { ParsedMarkdown } from '../markdown/parser';
5
+ import { DocSearchIndex } from '../search/search-index';
6
+ export interface ActiveDocData extends ParsedMarkdown {
7
+ slug: string;
8
+ title: string;
9
+ }
10
+ export interface NavDocItem {
11
+ slug: string;
12
+ title: string;
13
+ }
14
+ interface DocContextType {
15
+ config: DocConfig;
16
+ router: HashRouter;
17
+ currentSlug: string;
18
+ currentDoc: ActiveDocData | null;
19
+ tree: SidebarTreeNode[];
20
+ searchIndex: DocSearchIndex;
21
+ isLoading: boolean;
22
+ error: string | null;
23
+ prevDoc: NavDocItem | null;
24
+ nextDoc: NavDocItem | null;
25
+ isSearchOpen: boolean;
26
+ setIsSearchOpen: (open: boolean) => void;
27
+ isMobileSidebarOpen: boolean;
28
+ setIsMobileSidebarOpen: (open: boolean) => void;
29
+ navigate: (slug: string, anchor?: string) => void;
30
+ }
31
+ export declare const useDoc: () => DocContextType;
32
+ interface DocProviderProps {
33
+ initialConfig: DocConfig;
34
+ basePath?: string;
35
+ children: React.ReactNode;
36
+ }
37
+ export declare const DocProvider: React.FC<DocProviderProps>;
38
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ColorMode, ThemePreset } from '../types';
3
+ interface ThemeContextType {
4
+ mode: ColorMode;
5
+ resolvedMode: 'light' | 'dark';
6
+ preset: ThemePreset;
7
+ setMode: (mode: ColorMode) => void;
8
+ setPreset: (preset: ThemePreset) => void;
9
+ toggleMode: () => void;
10
+ }
11
+ export declare const useTheme: () => ThemeContextType;
12
+ interface ThemeProviderProps {
13
+ defaultMode?: ColorMode;
14
+ defaultPreset?: ThemePreset;
15
+ children: React.ReactNode;
16
+ }
17
+ export declare const ThemeProvider: React.FC<ThemeProviderProps>;
18
+ export {};
@@ -0,0 +1,23 @@
1
+ export interface RouteInfo {
2
+ slug: string;
3
+ anchor: string;
4
+ fullPath: string;
5
+ }
6
+ export declare class HashRouter {
7
+ private listeners;
8
+ private defaultDoc;
9
+ constructor(defaultDoc?: string);
10
+ destroy(): void;
11
+ setDefaultDoc(defaultDoc: string): void;
12
+ getCurrentRoute(): RouteInfo;
13
+ parseHash(rawHash: string): RouteInfo;
14
+ normalizeDocSlug(pathOrSlug: string): string;
15
+ navigate(path: string, anchor?: string): void;
16
+ scrollToAnchor(anchorId: string): void;
17
+ subscribe(callback: (route: RouteInfo) => void): () => void;
18
+ private handleHashChange;
19
+ /**
20
+ * Resolves a relative markdown link into a hash navigation target
21
+ */
22
+ resolveLink(href: string, currentSlug: string): string;
23
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { DocSearchIndex } from './search-index';
3
+ interface SearchModalProps {
4
+ isOpen: boolean;
5
+ onClose: () => void;
6
+ searchIndex: DocSearchIndex;
7
+ onSelect: (slug: string) => void;
8
+ placeholder?: string;
9
+ }
10
+ export declare const SearchModal: React.FC<SearchModalProps>;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import { DocFileItem, SearchResultItem } from '../types';
2
+ export declare class DocSearchIndex {
3
+ private miniSearch;
4
+ private indexedDocs;
5
+ constructor();
6
+ addDoc(doc: DocFileItem): void;
7
+ addDocs(docs: DocFileItem[]): void;
8
+ search(query: string, limit?: number): SearchResultItem[];
9
+ }
@@ -0,0 +1,165 @@
1
+ /**
2
+ * DocMeDown Configuration and Runtime Type Definitions
3
+ */
4
+ export type ThemePreset = 'indigo' | 'emerald' | 'sunset' | 'violet' | 'rose' | 'slate' | 'cyberpunk';
5
+ export type ColorMode = 'light' | 'dark' | 'auto';
6
+ export interface NavLink {
7
+ label: string;
8
+ href: string;
9
+ external?: boolean;
10
+ icon?: string;
11
+ }
12
+ export interface SocialLink {
13
+ type: 'github' | 'gitlab' | 'twitter' | 'x' | 'discord' | 'custom';
14
+ url: string;
15
+ label?: string;
16
+ icon?: string;
17
+ }
18
+ export interface RemoteSourceConfig {
19
+ type: 'github' | 'gitlab' | 'raw';
20
+ /** e.g. "facebook/react" or "owner/repo" */
21
+ repo?: string;
22
+ /** e.g. "main" or "master" */
23
+ branch?: string;
24
+ /** Subdirectory where markdown files live, e.g. "docs" or "" */
25
+ docsDir?: string;
26
+ /** Optional personal access token or auth for private repos */
27
+ token?: string;
28
+ /** Raw base URL override */
29
+ baseUrl?: string;
30
+ }
31
+ export interface SidebarItemConfig {
32
+ title?: string;
33
+ path?: string;
34
+ slug?: string;
35
+ icon?: string;
36
+ badge?: string;
37
+ badgeType?: 'info' | 'success' | 'warning' | 'new';
38
+ collapsed?: boolean;
39
+ children?: SidebarItemConfig[];
40
+ }
41
+ export interface DocThemeConfig {
42
+ preset?: ThemePreset;
43
+ defaultMode?: ColorMode;
44
+ accentColor?: string;
45
+ accentColorDark?: string;
46
+ fontFamily?: string;
47
+ codeTheme?: 'github' | 'dracula' | 'one-dark' | 'synthwave';
48
+ logo?: {
49
+ light?: string;
50
+ dark?: string;
51
+ alt?: string;
52
+ text?: string;
53
+ };
54
+ favicon?: string;
55
+ }
56
+ export interface DocSearchConfig {
57
+ enabled?: boolean;
58
+ placeholder?: string;
59
+ maxResults?: number;
60
+ }
61
+ export interface DocConfig {
62
+ name: string;
63
+ tagline?: string;
64
+ description?: string;
65
+ version?: string;
66
+ rootDoc?: string;
67
+ /** Source configuration: local filesystem or remote GitHub/GitLab */
68
+ source?: RemoteSourceConfig;
69
+ /** Visual and theme configurations */
70
+ theme?: DocThemeConfig;
71
+ /** Navigation bar links */
72
+ nav?: NavLink[];
73
+ /** Social and repository links */
74
+ socials?: SocialLink[];
75
+ /** Manual sidebar configuration (optional; auto-indexed if omitted) */
76
+ sidebar?: SidebarItemConfig[];
77
+ /** Auto-indexing options */
78
+ autoIndex?: {
79
+ enabled?: boolean;
80
+ exclude?: string[];
81
+ sort?: 'alphabetical' | 'frontmatter' | 'natural';
82
+ defaultCollapsed?: boolean;
83
+ };
84
+ /** Search options */
85
+ search?: DocSearchConfig;
86
+ /** Footer config */
87
+ footer?: {
88
+ copyright?: string;
89
+ links?: NavLink[];
90
+ showBuiltWith?: boolean;
91
+ };
92
+ /** Custom component directory or URL */
93
+ componentsUrl?: string;
94
+ /** Edit page link (e.g. "https://github.com/owner/repo/edit/main/docs/") */
95
+ editUrl?: string;
96
+ }
97
+ /** Options accepted by the browser integration entry point. */
98
+ export interface DocMeDownInitOptions {
99
+ el?: string | HTMLElement;
100
+ config?: Partial<DocConfig>;
101
+ basePath?: string;
102
+ }
103
+ /** Handle returned after mounting DocMeDown into a page. */
104
+ export interface DocMeDownInstance {
105
+ element: HTMLElement;
106
+ destroy: () => void;
107
+ }
108
+ export interface DocHeading {
109
+ level: number;
110
+ text: string;
111
+ id: string;
112
+ }
113
+ export interface DocFrontmatter {
114
+ title?: string;
115
+ sidebar_label?: string;
116
+ sidebar_position?: number;
117
+ order?: number;
118
+ description?: string;
119
+ icon?: string;
120
+ badge?: string;
121
+ badge_type?: 'info' | 'success' | 'warning' | 'new';
122
+ tags?: string[];
123
+ hidden?: boolean;
124
+ [key: string]: any;
125
+ }
126
+ export interface DocFileItem {
127
+ slug: string;
128
+ path: string;
129
+ title: string;
130
+ category?: string;
131
+ frontmatter: DocFrontmatter;
132
+ headings: DocHeading[];
133
+ content?: string;
134
+ readingTimeMinutes?: number;
135
+ lastModified?: string;
136
+ }
137
+ export interface DocManifest {
138
+ version: string;
139
+ generatedAt: string;
140
+ config: DocConfig;
141
+ docs: DocFileItem[];
142
+ tree: SidebarTreeNode[];
143
+ }
144
+ export interface SidebarTreeNode {
145
+ id: string;
146
+ title: string;
147
+ slug?: string;
148
+ path?: string;
149
+ icon?: string;
150
+ badge?: string;
151
+ badgeType?: 'info' | 'success' | 'warning' | 'new';
152
+ order: number;
153
+ isCategory: boolean;
154
+ collapsed?: boolean;
155
+ children?: SidebarTreeNode[];
156
+ }
157
+ export interface SearchResultItem {
158
+ id: string;
159
+ slug: string;
160
+ title: string;
161
+ category?: string;
162
+ snippet?: string;
163
+ heading?: string;
164
+ score?: number;
165
+ }
package/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "docmedown",
3
+ "version": "0.1.0",
4
+ "description": "The simplest MarkDown documenter yet. CLI & Web Script React SPA documentation engine.",
5
+ "main": "./dist/docmedown.cjs",
6
+ "module": "./dist/docmedown.mjs",
7
+ "types": "./dist/types/runtime/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/runtime/index.d.ts",
11
+ "import": "./dist/docmedown.mjs",
12
+ "require": "./dist/docmedown.cjs"
13
+ },
14
+ "./iife": "./dist/docmedown.iife.js"
15
+ },
16
+ "unpkg": "./dist/docmedown.iife.js",
17
+ "jsdelivr": "./dist/docmedown.iife.js",
18
+ "bin": {
19
+ "docmedown": "bin/docmedown.js",
20
+ "dmd": "bin/docmedown.js"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "bin",
25
+ "templates",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "scripts": {
30
+ "dev:runtime": "vite build --watch",
31
+ "build:runtime": "vite build",
32
+ "build:cli": "tsup",
33
+ "typecheck": "tsc --noEmit",
34
+ "build:types": "tsc -p tsconfig.runtime.json",
35
+ "build": "npm run build:runtime && npm run build:cli && npm run build:types",
36
+ "docmedown": "node ./bin/docmedown.js",
37
+ "dmd": "node ./bin/docmedown.js",
38
+ "init:docs": "node ./bin/docmedown.js init",
39
+ "serve": "node ./bin/docmedown.js serve ./docs",
40
+ "dev": "node ./bin/docmedown.js serve ./docs",
41
+ "build:docs": "node ./bin/docmedown.js build ./docs",
42
+ "build:docs:watch": "node ./bin/docmedown.js build ./docs --watch",
43
+ "build:offline": "node ./bin/docmedown.js build ./docs",
44
+ "config:docs": "node ./bin/docmedown.js config ./docs/docs.json",
45
+ "test": "npx tsx --test tests/parser.test.ts tests/scanner.test.ts tests/runtime-integration.test.ts tests/package-smoke.test.ts",
46
+ "test:release": "npm run typecheck && npm run test && npm run build && npm run build:docs && npm pack --dry-run",
47
+ "prepublishOnly": "npm run test:release"
48
+ },
49
+ "keywords": [
50
+ "markdown",
51
+ "documentation",
52
+ "docs",
53
+ "docusaurus",
54
+ "docsify",
55
+ "react",
56
+ "spa",
57
+ "cli",
58
+ "offline-docs",
59
+ "github-docs"
60
+ ],
61
+ "author": "Gabriel M. Silva",
62
+ "license": "MIT",
63
+ "engines": {
64
+ "node": ">=20.19.0"
65
+ },
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/gabrielmsilva00/docmedown.git"
69
+ },
70
+ "bugs": {
71
+ "url": "https://github.com/gabrielmsilva00/docmedown/issues"
72
+ },
73
+ "homepage": "https://github.com/gabrielmsilva00/docmedown#readme",
74
+ "packageManager": "npm@11.16.0",
75
+ "overrides": {
76
+ "tsup": {
77
+ "esbuild": "0.28.2"
78
+ }
79
+ },
80
+ "dependencies": {
81
+ "chalk": "^4.1.2",
82
+ "chokidar": "^3.6.0",
83
+ "commander": "^12.1.0",
84
+ "gray-matter": "^4.0.3",
85
+ "mime-types": "^2.1.35",
86
+ "open": "^10.1.0",
87
+ "prompts": "^2.4.2",
88
+ "ws": "^8.18.0"
89
+ },
90
+ "devDependencies": {
91
+ "@types/node": "^22.5.0",
92
+ "@types/prismjs": "^1.26.6",
93
+ "@types/prompts": "^2.4.9",
94
+ "@types/react": "^18.3.5",
95
+ "@types/react-dom": "^18.3.0",
96
+ "@types/ws": "^8.5.12",
97
+ "@vitejs/plugin-react": "^6.1.0",
98
+ "katex": "^0.16.11",
99
+ "marked": "^14.1.1",
100
+ "minisearch": "^7.1.0",
101
+ "prismjs": "^1.29.0",
102
+ "react": "^18.3.1",
103
+ "react-dom": "^18.3.1",
104
+ "tsup": "^8.2.4",
105
+ "tsx": "^4.19.0",
106
+ "typescript": "^5.5.4",
107
+ "vite": "^8.2.2",
108
+ "vite-plugin-css-injected-by-js": "^5.0.2"
109
+ }
110
+ }
@@ -0,0 +1,25 @@
1
+ const { createElement, useState } = window.React;
2
+
3
+ export function CounterWidget({ initial = 0 }) {
4
+ const [count, setCount] = useState(Number(initial));
5
+
6
+ return createElement(
7
+ 'button',
8
+ {
9
+ type: 'button',
10
+ onClick: () => setCount((value) => value + 1),
11
+ style: {
12
+ padding: '0.55rem 0.85rem',
13
+ border: '1px solid var(--dmd-accent)',
14
+ borderRadius: '6px',
15
+ background: 'var(--dmd-accent-subtle)',
16
+ color: 'var(--dmd-text-primary)',
17
+ cursor: 'pointer',
18
+ fontWeight: 700,
19
+ },
20
+ },
21
+ `Interactive counter: ${count}`
22
+ );
23
+ }
24
+
25
+ export default { CounterWidget };