Skip to content

Commit b636418

Browse files
committed
chore: v0.3.0 - reorganize docs and update documentation
- Move INTEGRATION.md and ROADMAP.md to project root - Update documentation content across API and guides - Bump create-markdown package to v0.3.0
1 parent 62e688b commit b636418

13 files changed

Lines changed: 1970 additions & 549 deletions

File tree

File renamed without changes.
File renamed without changes.

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/create-markdown/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "MIT",
77
"repository": {
88
"type": "git",
9-
"url": "https://github.com/BunsDev/create-markdown",
9+
"url": "git+https://github.com/BunsDev/create-markdown.git",
1010
"directory": "packages/create-markdown"
1111
},
1212
"homepage": "https://github.com/BunsDev/create-markdown",

packages/docs/content/api/core.mdx

Lines changed: 72 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,113 @@
11
---
2-
title: Core API
3-
description: Block-based markdown parsing and serialization
2+
title: "Core API"
3+
description: "Block-based markdown parsing and serialization"
44
---
55

6-
# Core API
6+
# @create-markdown/core
77

8-
The `@create-markdown/core` package provides block-based markdown parsing and serialization with zero dependencies.
8+
Block-based markdown parsing and serialization with zero dependencies.
99

1010
## Installation
1111

1212
```bash
13+
# Using bun
1314
bun add @create-markdown/core
14-
```
1515

16-
## Parsing
16+
# Using npm
17+
npm install @create-markdown/core
18+
19+
# Using yarn
20+
yarn add @create-markdown/core
21+
22+
# Using pnpm
23+
pnpm add @create-markdown/core
24+
```
1725

18-
### parse
26+
## Quick Start
1927

20-
Parse a markdown string to an array of blocks.
28+
### Parse Markdown to Blocks
2129

2230
```typescript
2331
import { parse } from '@create-markdown/core';
2432

2533
const blocks = parse(`# Hello World
2634
27-
This is **bold** text.
35+
This is **bold** and *italic* text.
2836
2937
- Item one
3038
- Item two
3139
`);
3240
```
3341

34-
### markdownToBlocks
35-
36-
Full parser with options.
37-
38-
```typescript
39-
import { markdownToBlocks } from '@create-markdown/core';
40-
41-
const blocks = markdownToBlocks(markdown, {
42-
generateId: () => crypto.randomUUID(),
43-
strict: false,
44-
});
45-
```
46-
47-
### markdownToDocument
48-
49-
Parse to a Document object with metadata.
42+
### Create Blocks Programmatically
5043

5144
```typescript
52-
import { markdownToDocument } from '@create-markdown/core';
45+
import { h1, paragraph, bulletList, bold, italic, spans } from '@create-markdown/core';
5346

54-
const doc = markdownToDocument(markdown);
55-
console.log(doc.blocks);
56-
console.log(doc.meta);
47+
const blocks = [
48+
h1('My Document'),
49+
paragraph(spans(
50+
bold('Important: '),
51+
{ text: 'This is ', styles: {} },
52+
italic('really'),
53+
{ text: ' cool!', styles: {} }
54+
)),
55+
bulletList(['First item', 'Second item', 'Third item']),
56+
];
5757
```
5858

59-
## Serialization
60-
61-
### stringify
62-
63-
Serialize blocks to markdown.
59+
### Serialize Blocks to Markdown
6460

6561
```typescript
66-
import { stringify, h1, paragraph } from '@create-markdown/core';
62+
import { stringify, h1, paragraph, codeBlock } from '@create-markdown/core';
6763

6864
const markdown = stringify([
6965
h1('Hello'),
7066
paragraph('World'),
67+
codeBlock('console.log("Hi!");', 'javascript'),
7168
]);
7269
```
7370

74-
### blocksToMarkdown
75-
76-
Full serializer with options.
77-
78-
```typescript
79-
import { blocksToMarkdown } from '@create-markdown/core';
80-
81-
const markdown = blocksToMarkdown(blocks, {
82-
bulletChar: '-',
83-
emphasisChar: '*',
84-
});
85-
```
86-
8771
## Block Types
8872

8973
| Type | Factory Function | Description |
90-
|------|-----------------|-------------|
91-
| paragraph | `paragraph(content)` | Text paragraph |
92-
| heading | `h1` - `h6` | Heading levels 1-6 |
93-
| bulletList | `bulletList(items)` | Unordered list |
94-
| numberedList | `numberedList(items)` | Ordered list |
95-
| checkList | `checkList(items)` | Task list with checkboxes |
96-
| codeBlock | `codeBlock(code, lang?)` | Fenced code block |
97-
| blockquote | `blockquote(content)` | Block quote |
98-
| image | `image(url, alt?)` | Image |
99-
| divider | `divider()` | Horizontal rule |
100-
| table | `table(headers, rows)` | Table with headers |
101-
| callout | `callout(type, content)` | Callout/admonition |
102-
103-
## Block Factory Functions
104-
105-
```typescript
106-
import {
107-
h1, h2, h3, h4, h5, h6,
108-
paragraph,
109-
bulletList,
110-
numberedList,
111-
codeBlock,
112-
blockquote,
113-
image,
114-
divider,
115-
table,
116-
callout,
117-
} from '@create-markdown/core';
118-
119-
const blocks = [
120-
h1('Welcome'),
121-
paragraph('This is a paragraph.'),
122-
codeBlock('const x = 1;', 'typescript'),
123-
bulletList(['Item 1', 'Item 2']),
124-
divider(),
125-
];
126-
```
127-
128-
## Inline Styles
129-
130-
```typescript
131-
import { bold, italic, code, link, strikethrough, highlight } from '@create-markdown/core';
132-
133-
const content = [
134-
bold('Bold text'),
135-
italic('Italic text'),
136-
code('inline code'),
137-
link('Click here', 'https://example.com'),
138-
strikethrough('deleted'),
139-
highlight('highlighted'),
140-
];
141-
```
142-
143-
## Document Operations
144-
145-
```typescript
146-
import {
147-
createDocument,
148-
appendBlock,
149-
removeBlock,
150-
updateBlock,
151-
moveBlock,
152-
findBlock,
153-
} from '@create-markdown/core';
154-
155-
// Create a document
156-
let doc = createDocument([paragraph('First')]);
157-
158-
// Add a block
159-
doc = appendBlock(doc, paragraph('Second'));
160-
161-
// Find a block
162-
const block = findBlock(doc, 'some-id');
163-
164-
// Remove a block
165-
doc = removeBlock(doc, 'some-id');
166-
167-
// Move a block
168-
doc = moveBlock(doc, 'block-id', 0);
169-
```
74+
| --- | --- | --- |
75+
| `paragraph` | `paragraph(content)` | Text paragraph |
76+
| `heading` | `heading(level, content)` or `h1`-`h6` | Heading levels 1-6 |
77+
| `bulletList` | `bulletList(items)` | Unordered list |
78+
| `numberedList` | `numberedList(items)` | Ordered list |
79+
| `checkList` | `checkList(items)` | Task list with checkboxes |
80+
| `codeBlock` | `codeBlock(code, language?)` | Fenced code block |
81+
| `blockquote` | `blockquote(content)` | Block quote |
82+
| `image` | `image(url, alt?)` | Image |
83+
| `divider` | `divider()` | Horizontal rule |
84+
| `table` | `table(headers, rows)` | Table with headers |
85+
| `callout` | `callout(type, content)` | Callout/admonition |
86+
87+
## API Reference
88+
89+
### Parsing
90+
91+
- `parse(markdown)` - Parse markdown string to blocks
92+
- `markdownToBlocks(markdown, options?)` - Full parser with options
93+
- `markdownToDocument(markdown)` - Parse to a Document object
94+
95+
### Serialization
96+
97+
- `stringify(blocks)` - Serialize blocks to markdown
98+
- `blocksToMarkdown(blocks, options?)` - Full serializer with options
99+
- `documentToMarkdown(doc)` - Serialize a Document
100+
101+
### Document Operations
102+
103+
- `createDocument(blocks?, options?)` - Create a new document
104+
- `insertBlock(doc, block, index?)` - Insert block at position
105+
- `appendBlock(doc, block)` - Add block at end
106+
- `removeBlock(doc, blockId)` - Remove block by ID
107+
- `updateBlock(doc, blockId, updates)` - Update block properties
108+
- `moveBlock(doc, blockId, newIndex)` - Reorder blocks
109+
- `findBlock(doc, blockId)` - Find block by ID
110+
111+
## License
112+
113+
MIT

0 commit comments

Comments
 (0)