Skip to content

Proposal: Obsidian flavored markdown support in the preview #219

Closed

Description

@astrawrld

Description

Hi! I use MarkEdit with Obsidian vaults and added Obsidian flavored markdown support to MarkEdit-preview locally. It's working well for me, and I'd like to contribute it upstream. As the README asks, I'm opening this to discuss before sending a PR.

What it adds

Syntax Rendering
> [!faq] Title Callouts with all Obsidian types and aliases, custom titles with inline markdown, nesting; unknown types fall back to note
> [!tip]- / > [!tip]+ Foldable callouts (<details>), collapsed or expanded
==text== <mark> highlights
%%comment%%, multi-line %% blocks Hidden
#tag, #nested/tag Tag pills (not links, so they don't collide with heading anchors)
text ^block-id Identifier hidden, used as the block's id
[[#Heading]], [[#^block-id]] Links within the same note
![[image.png|300x200]] Images, with optional size, resolved relative to the current file
![[Note]] Rendered as a link

GitHub alerts (> [!NOTE]) render exactly as before: same markdown-alert markdown-alert-<type> classes, and the GitHub types keep their colors.

How it's built

  • One markdown-it plugin (src/features/obsidian.ts) with block, inline and core rules. The source is never rewritten, so data-line-from / data-line-to, sync scroll, task toggling and headingLineForAnchor are unaffected. Code spans and fences are skipped automatically.
  • Callouts replace markdown-it-github-alerts. It ends a callout at the first blockquote_close, which produces unbalanced HTML for nested callouts. The replacement matches by nesting level.
  • Styles live in styles/obsidian/base.css and use the active theme's color variables where possible. They're added to both the live pane and styled HTML export, and skipped when themeName is "none".
  • Plain [[wikilinks]] are left as text, so extensions like MarkEdit-wikilinks can resolve them across a vault. Their contents are kept intact (e.g. [[__init__]] isn't turned into bold).
  • Tests: tests/obsidian.test.ts (27 cases). Typecheck and lint pass, and existing tests are unchanged.
  • Mixed mode isn't touched.

Optional second part: wikilinks in Quick Look

Quick Look can't load other extensions, so wikilinks show as raw [[…]] there. A small follow-up (~260 lines) would:

  • render [[target|alias]] as links in the Quick Look preview (lite hosts only), and
  • highlight wikilinks in the Quick Look source view using the CSS Custom Highlight API. This paints ranges without touching CodeMirror's DOM; it needs macOS 14.2+ and does nothing on older systems.

Questions

  1. Is this in scope for the extension? Would you like it as is, behind a setting, or split up differently?
  2. Note embeds (![[Note]]) use the me-wikilink class and data-wikilink-target attribute from MarkEdit-wikilinks, so its click handler can open them. Is that coupling OK, or would you prefer a neutral class?
  3. Do you want the Quick Look part, and if so, as a separate PR?
  4. markdown-it-github-alerts becomes unused. Should the PR also remove it from package.json and yarn.lock?

Happy to adjust anything. Thanks for MarkEdit!

Activity

  1. cyanzhong commented on Oct 26, 2026

    @cyanzhong
    Contributor

    Sorry I don't like non-standard inventions, especially not in core extensions like this one.

    When someone uses these in one app and cannot migrate them to another app, this is lock-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions