Skip to content

Commit e06cc68

Browse files
committed
feat: refresh docs and lint config for v1.3
1 parent a93113f commit e06cc68

5 files changed

Lines changed: 78 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Setup Bun
15+
uses: oven-sh/setup-bun@v2
16+
with:
17+
bun-version: 1.3.0
18+
- name: Install dependencies
19+
run: bun install --frozen-lockfile
20+
- name: Lint
21+
run: bun run lint
22+
- name: Build
23+
run: bun run build

app/docs/api-reference/page.tsx

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ npm install omniscript-parser
4141
// Parse OSF to AST
4242
const osfCode = \`
4343
@meta { title: "My Document"; }
44-
@doc { content: "# Hello World"; }
44+
@doc {
45+
# Hello World
46+
}
4547
\`;
4648
4749
const ast = parse(osfCode);
4850
console.log(ast);
49-
// Output: { version: "1.0", blocks: [...] }
51+
// Output: { blocks: [...] }
5052
5153
// Serialize AST back to OSF
5254
const osfOutput = serialize(ast);
@@ -56,15 +58,15 @@ console.log(osfOutput);`}
5658
<h3 className="text-2xl font-bold mb-4">API</h3>
5759

5860
<div className="mb-6 border-2 border-blue-500 p-6">
59-
<h4 className="font-bold text-xl mb-3">parse(osfCode: string): OSFDocument</h4>
61+
<h4 className="font-bold text-xl mb-3">parse(osfCode: string, options?: ParseOptions): OSFDocument</h4>
6062
<p className="text-gray-300 mb-4">
6163
Parses OSF text into an Abstract Syntax Tree (AST).
6264
</p>
6365
<p className="text-sm text-gray-400">
64-
<strong>Parameters:</strong> osfCode - String containing OSF content
66+
<strong>Parameters:</strong> osfCode - String containing OSF content; options - Include resolution settings
6567
</p>
6668
<p className="text-sm text-gray-400">
67-
<strong>Returns:</strong> OSFDocument object with version and blocks array
69+
<strong>Returns:</strong> OSFDocument object with blocks array (and includes when present)
6870
</p>
6971
<p className="text-sm text-gray-400">
7072
<strong>Throws:</strong> Error if syntax is invalid
@@ -89,26 +91,24 @@ console.log(osfOutput);`}
8991
{`interface OSFDocument {
9092
version?: string;
9193
blocks: OSFBlock[];
94+
includes?: IncludeDirective[];
9295
}
9396
94-
type OSFBlock =
95-
| MetaBlock
96-
| DocBlock
97-
| SlideBlock
98-
| SheetBlock
99-
| ChartBlock
100-
| DiagramBlock
101-
| OSFCodeBlock;
97+
type OSFValue = string | number | boolean | OSFValue[] | { [key: string]: OSFValue };
98+
99+
type OSFBlock =
100+
| MetaBlock
101+
| DocBlock
102+
| SlideBlock
103+
| SheetBlock
104+
| ChartBlock
105+
| DiagramBlock
106+
| OSFCodeBlock
107+
| TableBlock;
102108
103109
interface MetaBlock {
104110
type: 'meta';
105-
title?: string;
106-
author?: string;
107-
date?: string;
108-
version?: string;
109-
theme?: string;
110-
tags?: string[];
111-
description?: string;
111+
props: Record<string, OSFValue>;
112112
}
113113
114114
interface ChartBlock {
@@ -117,6 +117,21 @@ interface ChartBlock {
117117
title: string;
118118
data: ChartDataSeries[];
119119
options?: ChartOptions;
120+
}
121+
122+
interface TableBlock {
123+
type: 'table';
124+
caption?: string;
125+
style?: 'bordered' | 'striped' | 'minimal';
126+
alignment?: ('left' | 'center' | 'right')[];
127+
headers: string[];
128+
rows: { cells: { text: string }[] }[];
129+
}
130+
131+
interface IncludeDirective {
132+
type: 'include';
133+
path: string;
134+
resolved?: OSFDocument;
120135
}`}
121136
</pre>
122137
</section>
@@ -191,6 +206,8 @@ fs.writeFileSync('output.xlsx', result.buffer);`}
191206
orientation?: 'portrait' | 'landscape';
192207
fontSize?: number;
193208
fontFamily?: string;
209+
timeoutMs?: number; // PDF rendering timeout (ms)
210+
puppeteerArgs?: string[]; // Custom Puppeteer launch args
194211
}`}
195212
</pre>
196213

bun.lock

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

eslint.config.mjs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
import { FlatCompat } from "@eslint/eslintrc";
2-
import { dirname } from "node:path";
3-
import { fileURLToPath } from "node:url";
1+
// File: eslint.config.mjs
2+
// What: ESLint configuration for the OmniScript documentation site
3+
// Why: Enable non-interactive linting with Next.js + TypeScript rules
4+
// Related: package.json scripts, next.config.js
5+
import { FlatCompat } from '@eslint/eslintrc';
6+
import { dirname } from 'node:path';
7+
import { fileURLToPath } from 'node:url';
48

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
9+
const __dirname = dirname(fileURLToPath(import.meta.url));
710
const compat = new FlatCompat({ baseDirectory: __dirname });
811

912
const eslintConfig = [
10-
...compat.extends("next/core-web-vitals", "next/typescript"),
1113
{
12-
ignores: [
13-
"node_modules/**",
14-
".next/**",
15-
"out/**",
16-
"build/**",
17-
"next-env.d.ts",
18-
],
14+
ignores: ['node_modules/**', '.next/**', 'out/**', 'build/**', 'next-env.d.ts'],
15+
},
16+
...compat.extends('next/core-web-vitals', 'next/typescript'),
17+
{
18+
files: ['**/*.d.ts'],
19+
rules: {
20+
'@typescript-eslint/triple-slash-reference': 'off',
21+
},
1922
},
2023
];
2124

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"react-dom": "^19.2.3"
2020
},
2121
"devDependencies": {
22+
"@eslint/eslintrc": "^3.3.0",
2223
"@types/node": "24.8.1",
2324
"@types/react": "19.2.2",
2425
"@types/react-dom": "19.2.2",

0 commit comments

Comments
 (0)