An open API service indexing awesome lists of open source software.

https://github.com/noclaps/znak

A Markdown-like markup language
https://github.com/noclaps/znak

go golang markdown markup-language mathml syntax-highlighting

Last synced: 7 months ago
JSON representation

A Markdown-like markup language

Awesome Lists containing this project

README

          

# Znak

A parser for a Markdown-like markup language that supports a smaller subset of Markdown syntax, and is stricter and more opinionated. It has features like syntax highlighting, $\LaTeX$, and heading IDs built-in.

You can read the syntax [here](./docs/syntax.md). You can also read the documentation for Highlight (the syntax highlighter in Znak) [here](./docs/highlight.md).

## Usage

Add it as a dependency to your project:

```sh
go get -u github.com/noclaps/znak
```

Then you can use it in your code:

```go
package main

import (
"github.com/noclaps/znak"
"github.com/noclaps/znak/highlight"
)

func main() {
themeFile, err := os.ReadFile("path/to/theme.css")
codeTheme, err := highlight.NewTheme(themeFile)

inputFile, err := os.ReadFile("path/to/file.md")
input := string(inputFile)

renderedHtml, err := znak.Render(input, codeTheme)
headings := znak.Headings(input)
frontmatter, err := znak.Frontmatter(input)
}
```

## Acknowledgements

$\LaTeX$ is rendered to MathML using [Wyatt915/TreeBlood](https://github.com/Wyatt915/treeblood).

The example code theme in `theme.css` is taken from [PyaeSoneAungRgn/github-zed-theme](https://github.com/PyaeSoneAungRgn/github-zed-theme).