mdutils

package
v0.0.0-...-e9cf350 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

README

mdutils Markdown Utilities

This module contains some tooling to explore the content of markdown files.

Helpful post for playing with blackfriday: https://parsiya.net/blog/2018-10-28-blackfridays-parser-and-generating-graphs-with-gographviz/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAllLinks(ast *blackfriday.Node) []blackfriday.LinkData

ExtractAllLinks will extract all links from the passed ast.

func FilterLocalLinks(links []blackfriday.LinkData) []blackfriday.LinkData

FilterLocalLinks will extract all "local" links, ie, links pointing to the local file system and not starting with "http[s]://...". This is done by looking at the link's destination. Links of the form "/absolute-link", "../sibling-dir/something", "sub-dir/something", nothing else. Note on anchors: links pointing to anchors in the same file will not be returned. Links pointing to other files while also containing an anchor (ie, in the form <path_to_file>#<anchor-name> are returned.

func ParseFileToAst

func ParseFileToAst(markdownFile string) (*blackfriday.Node, error)

ParseFileToAst parses a file living at the path specified at marcdownFile and returns an abstract syntax tree

Types

type Change

type Change struct {
	Date         string
	HeaderNode   *blackfriday.Node
	ContentNodes []*blackfriday.Node
}

Change contains the parsed content of a single change from a CHANGELOG file

func GetChanges

func GetChanges(ast *blackfriday.Node) ([]*Change, error)

GetChanges explores the passed ast, expecting it to contain a changelog with section titles that start with a date in the form DD.MM.YYYY it returns an ordered slice of changes

Jump to

Keyboard shortcuts

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