markdown

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package markdown extracts what the index needs from a note body: tags (#tag, nested #a/b), wikilinks ([[Title]], [[path|alias]], [[x#heading]]), embeds (![[x]]) and links to local notes (text(other.md)).

goldmark finds code blocks, code spans and raw HTML, which are masked out first, so a "#define" in a code block is not a tag. The Obsidian syntax itself is matched with small regular expressions on what is left.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanTag

func CleanTag(t string) string

CleanTag normalizes a tag: no leading "#", no trailing "/", and at least one character that is not a digit (Obsidian treats "#2026" as text). It returns "" for something that is not a tag.

Types

type Link struct {
	// Target is the link target without heading or block reference, as
	// written: "Title", "folder/Note", "Note.md". For markdown links it is
	// the destination resolved against the note's folder.
	Target string `json:"target"`
	// Heading is the part after "#" (a heading, or "^id" for a block).
	Heading string `json:"heading,omitempty"`
	// Alias is the display text after "|".
	Alias string `json:"alias,omitempty"`
	// Embed is true for ![[x]].
	Embed bool `json:"embed,omitempty"`
	// Wiki is true for [[…]] links, false for [text](dest.md) links.
	Wiki bool `json:"wiki"`
}

Link is one outgoing link of a note.

type Parsed

type Parsed struct {
	Tags  []string
	Links []Link
}

Parsed is the result of Parse.

func Parse

func Parse(body []byte, folder string) Parsed

Parse extracts tags and links from a note body (without frontmatter). folder is the note's vault-relative folder, used to resolve relative markdown links.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL