mdconv

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(wr io.Writer, doc gemtext.Document, overrides *template.Template) error

Convert writes markdown to a writer from the provided gemtext document.

Templates can be provided to override the output for different line types. The templates supported are:

  • "header" is called before any lines and is passed the full Document.
  • "footer" is called after the lines and is passed the full Document.
  • "textline" is called once per line of text and is passed a gemtext.TextLine.
  • "linkline" is called once per link line and is passed a gemtext.LinkLine.
  • "preformattedtextlines" is called once for a block of preformatted text and is passed a slice of gemtext.PreformattedTextLines.
  • "heading1line" is called once per h1 line and is passed a gemtext.Heading1Line.
  • "heading2line" is called once per h2 line and is passed a gemtext.Heading2Line.
  • "heading3line" is called once per h3 line and is passed a gemtext.Heading3Line.
  • "listitemlines" is called once for a block of contiguous list item lines and is passed a slice of gemtext.ListItemLines.
  • "quoteline" is passed once per blockquote line and is passed a gemtext.QuoteLine.

There exist default implementations of each of these templates, so the "overrides" argument can be nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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