Skip to content

Commit 10dda76

Browse files
committed
feat(browser): add markdown provider and update persistence setup
1 parent 90edab7 commit 10dda76

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

examples/content-hub/browser/browser.workspace.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import {
2424
select,
2525
text,
2626
} from '@epicenter/hq';
27-
import { sqliteProvider } from '@epicenter/hq/providers/sqlite';
27+
import { markdownProvider } from '@epicenter/hq/providers/markdown';
2828
import { setupPersistence } from '@epicenter/hq/providers/persistence';
29+
import { sqliteProvider } from '@epicenter/hq/providers/sqlite';
2930
import { type } from 'arktype';
3031

3132
// ─────────────────────────────────────────────────────────────────────────────
@@ -139,8 +140,13 @@ export const browser = defineWorkspace({
139140
},
140141

141142
providers: {
142-
persistence: setupPersistence,
143+
persistence: (c) => setupPersistence(c),
143144
sqlite: (c) => sqliteProvider(c),
145+
// Markdown provider uses defaults:
146+
// - Filename: {id}.md
147+
// - All fields except id in frontmatter
148+
// - Empty body
149+
markdown: (c) => markdownProvider(c),
144150
},
145151

146152
exports: ({ tables, providers }) => ({
@@ -151,6 +157,10 @@ export const browser = defineWorkspace({
151157
pullToSqlite: providers.sqlite.pullToSqlite,
152158
pushFromSqlite: providers.sqlite.pushFromSqlite,
153159

160+
// Markdown provider operations
161+
pullToMarkdown: providers.markdown.pullToMarkdown,
162+
pushFromMarkdown: providers.markdown.pushFromMarkdown,
163+
154164
// ─────────────────────────────────────────────────────────────────────────
155165
// Query Actions
156166
// ─────────────────────────────────────────────────────────────────────────
@@ -277,8 +287,7 @@ export const browser = defineWorkspace({
277287
*/
278288
deleteTabsByUrlPattern: defineMutation({
279289
input: type({ pattern: 'string' }),
280-
description:
281-
'Delete all tabs matching a URL pattern (substring match)',
290+
description: 'Delete all tabs matching a URL pattern (substring match)',
282291
handler: ({ pattern }) => {
283292
const lowerPattern = pattern.toLowerCase();
284293
const matching = tables.tabs.filter((t) =>
@@ -302,8 +311,7 @@ export const browser = defineWorkspace({
302311
* Use with caution - this will sync to the extension!
303312
*/
304313
clearAll: defineMutation({
305-
description:
306-
'Clear all tabs, windows, and tab groups from the Y.Doc',
314+
description: 'Clear all tabs, windows, and tab groups from the Y.Doc',
307315
handler: () => {
308316
tables.$transact(() => {
309317
tables.$clearAll();

0 commit comments

Comments
 (0)