Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

powerman/goldmark-obsidian

Open more actions menu

Repository files navigation

goldmark-obsidian

License MIT Go version Test Coverage Status Release Go Reference

Linux | amd64 arm64 armv7 ppc64le s390x riscv64 macOS | amd64 arm64 Windows | amd64 arm64

An Obsidian extension for the goldmark markdown parser.

Features

Obsidian

  • Autolinks (GFM): https://example.com
  • Internal links: [[Link]]
  • Embed files: ![[Link]]
  • Block references: ![[Link#^id]]
  • Defining a block: ^id
  • Comments (block, inline): %%Text%%
  • Strikethroughs (GFM): ~~Text~~
  • Highlights: ==Text==
  • Code blocks: ```
  • Incomplete task (GFM): - [ ]
  • Completed task (GFM): - [x]
  • Callouts: > [!note]
  • Tables (GFM)
  • Footnotes (reference): Example[^1].
  • Footnotes (inline): Example. ^[This is an inline footnote.]
  • Diagrams (Mermaid): ```mermaid
  • LaTeX (MathJax): $$
  • Tags: #tag
  • Properties (metadata): --- at the very beginning of a file

Known inconsistencies with Obsidian:

  • Properties may start and end with at least 1 dash, not exactly 3 (---).
  • Tags defined in properties are not applied to document in same way as other tags.
  • Document aliases defined in properties are not processed as internal link targets.

TODO:

  • Add basic tests for all syntax used in Obsidian Help.
  • Add support for comments (both block and inline).
  • Add support for highlights.
  • Add support for callouts.

Not planned (PR is welcome):

  • Support for inline footnotes.

Obsidian plugin Tasks

TODO:

  • Add an option to support Global Filter (with tag removal).
  • Add an option to set a Default Date.

Not planned (PR is welcome):

  • Dataview Format.

Installation

go get github.com/powerman/goldmark-obsidian

Usage

source := []byte(`
- [ ] Happy New Year 📅 2025-01-01 ^first-task
- [x] Happy Old Year 📅 2024-01-01
`)

md := goldmark.New(
    goldmark.WithExtensions(
        obsidian.NewPlugTasks(),
        obsidian.NewObsidian(),
    ),
)
err := md.Convert(source, os.Stdout)
if err != nil {
    fmt.Println(err)
}
// Output:
// <ul class="contains-task-list">
// <li data-task="" class="task-list-item" id="^first-task"><input disabled="" type="checkbox" class="task-list-item-checkbox"> Happy New Year 📅 2025-01-01</li>
// <li data-task="x" class="task-list-item is-checked"><input checked="" disabled="" type="checkbox" class="task-list-item-checkbox"> Happy Old Year 📅 2024-01-01</li>
// </ul>

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.