Plugin: importer (Obsidian / Notion / Logseq) (#73)#144
Merged
Conversation
First end-to-end consumer of the v1.2 plugin API. Adds public/plugins/noteser-importer which renders a fullscreen view with a source-format radio (Obsidian vault folder / Notion ZIP / Logseq folder), opens the matching native picker, walks the source, and creates notes via ctx.vault.write.createNote. Conflict policy lives in the host: createNote auto-suffixes " (imported)" on collisions and the response carries conflictResolved which the plugin tallies. Logseq block refs degrade to a "> note from Logseq import: block ref <id>" blockquote and bump a lossy counter shown in the summary. Tests cover the three parsers against small fixtures, conflict + lossy tallies through a fake context, and the error path advancing without halting the loop. Library choice: fflate browser ESM (~22 KB gz) shipped under the plugin dir, mirroring noteser-pdf-export's jspdf pattern. Smaller than jszip and only loaded when the user picks Notion. Closes #73. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #73. Lands
public/plugins/noteser-importeras the first end-to-end consumer of the v1.2 plugin API, exercising thefullscreenViewsurface,ctx.fs.openDirectory,ctx.requestFileOpen,ctx.vault.write.createNote, andctx.onVNodeEventtogether.The plugin renders a fullscreen view with a source-format radio (Obsidian vault folder / Notion ZIP export / Logseq export folder), opens the matching native picker, walks the source, and creates notes through
vault.write.createNote. Conflict resolution lives in the host:createNotealready auto-suffixes(imported)on title collisions and the response carriesconflictResolved, which the plugin tallies. Logseq((block-id))references degrade to a literal blockquote (> note from Logseq import: block ref <id>) and bump a lossy counter shown in the summary.Why a plugin (not core)
The v1.2 plan (
docs/plugins-v1.2-plan.md§13) calls out the importer specifically as a v1.2 use case. The plugin surface exists exactly so that drop-in format support like this does not have to live in core. Per Jon's rule "plugin where possible" — this PR moves importer logic out of core entirely (issue #73 originally proposedsrc/utils/import.ts).Library choice — fflate
Notion exports arrive as a single
.zip. Options considered:jszip(already a noteser core dep): ~96 KB minified, ~28 KB gz, but it is bundled into the core app. Shipping it via the plugin URL would mean a second copy at the user's plugin host.fflatebrowser ESM: 91 KB raw, ~22 KB gz, MIT-licensed. ExposesunzipSyncas a named export. Shipped vendored aspublic/plugins/noteser-importer/fflate.module.js, matching thenoteser-pdf-export/jspdf.es.min.jspattern.22 KB gz is heavier than the ideal ~10 KB gz target because fflate ships the full compress + decompress surface; the plugin only calls
unzipSync. A future v0.2 could swap to the UMD-min build (~12 KB gz) or a hand-trimmed inflate-only fork if size pressure shows up. For v0.1 the standard ESM keeps the diff reviewable.Lossy conversions documented
[[Note]]), frontmatter, and#tagssurvive..mdlinks ([Label](Page%20name%20abc...md)) rewrite to[[Label]]. Externalhttps://links and.csv(database) links pass through untouched.((block-id))references degrade to> note from Logseq import: block ref <id>(the cross-page block index is not portable) and the count surfaces in the final summary.Test plan
npm run lintcleannpx tsc --noEmitzero errorsnpm test -- --cigreen (2578 passing, 17 skipped, including the new 14 importerPlugin tests)/plugins/noteser-importer/manifest.json, run "Import notes from..." from the command palette, pick a small Obsidian folder, confirm notes land in the sidebar with folder structure preservedFiles touched
Co-Authored-By: Claude Opus 4.7