Feat/auto markdown links tags#81
Draft
Floper wants to merge 11 commits into
Draft
Conversation
Open
check isAutoSyncMarkdownEnabled first.then check file extension
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.
Markdown export: links, tags, OCR markup, auto-sync and mirror folder
This PR builds on the updated
supernote-typescriptsubmodule (which now parsesinternal links and keyword stars) to surface those features as Obsidian-native
constructs in the exported markdown. It also fixes several bugs in the auto-sync
workflow and adds new settings to control the behaviour.
Supernote keywords → Obsidian tags
Starred keywords from the Supernote app are emitted as Obsidian tags (e.g.
#Supernote_Keyword) on the correct page of the exported markdown, rather thanas a flat list at the top of the document.
1-indexed), matching the LINKO key format. This is more reliable than the
KEYWORDPAGEfield, which can be'0'(invalid).same tag was already embedded in the processed OCR text (see below), it is not
repeated in the page header.
yet indexed in the Obsidian vault — are still recognised as tags rather than
headings during OCR processing.
Supernote links → Wikilinks
Internal links created via the Supernote link feature are emitted as Obsidian
Wikilinks on the correct page.
1-indexed) rather than
OBJPAGE, which is unreliable.(the key encodes the Y coordinate after the page prefix).
textfield already contains#Page N(resolved by the library). For cross-file links the plugin loads thetarget
.notefrom the vault, parses it, and resolves thePAGEIDto a pagenumber — e.g.
[[other-note#Page 2]]. A per-call cache avoids re-parsing thesame file multiple times.
PAGEID: 'none'or where the target file is not in the vaultproduce a plain Wikilink without a page anchor.
OCR markup:
#→ tags/headings,@→ WikilinksA new
processHashtagsAndMentionsfunction post-processes the OCR text of eachpage:
#Wordor# Word: checked against the Obsidian vault tag index. If the tagexists → inline tag (
#Word); otherwise → Markdown heading (# Word). Two-wordcombinations (e.g.
# Existing Tag) are also checked as#existing_tagbeforefalling back to a heading. The note's own keyword stars are checked first so
newly created tags are recognised even before they appear in the vault index.
@ Word(s): everything after the@on the same line becomes a Wikilink(
[[Word(s)]]), supporting multi-word note names.Auto-sync fixes
`${file.parent?.path}/${file.basename}.md`which produces//name.mdforvault-root files (Obsidian returns
"/"as the root folder path). The outputpath is now derived from
file.path.replace(/\.note$/i, '.md'), which Obsidianalways formats correctly.
.notefile syncs, Obsidian fires both'create'and
'modify'events in quick succession. Both handlers calledvault.create, causing a "File already exists" error. Theoverwritepathnow wraps
vault.createin a try/catch and retries withvault.modifywhenthe file appeared between the existence check and the create.
attachMarkdownFilenow properlyawaitswriteMarkdownFileso errorssurface rather than being silently dropped as unhandled promise rejections.
.catch()handlers added to both vault event callbacks so any remaining errorsappear in the developer console instead of as uncaught exceptions.
Markdown mirror folder
A new optional setting lets users save all exported markdown files into a
dedicated vault folder that mirrors the
.notefile structure, instead ofplacing each
.mdfile alongside its.notefile.alongside). Example value:
SupernoteMarkdowns.ensureFolderExistswalks the path segment by segment, creating any missingintermediate folders (with a concurrent-creation guard).
New settings
All new behaviours are opt-out via toggles in the plugin settings:
isAutoSyncMarkdownEnabledfalse.notefile changesisKeywordsAndLinksEnabledtrueisHashtagsMentionsEnabledtrue#and@in OCR textmarkdownMirrorFolder""