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
- Host: GitHub
- URL: https://github.com/noclaps/znak
- Owner: noClaps
- License: 0bsd
- Created: 2025-03-21T14:27:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-13T00:37:52.000Z (8 months ago)
- Last Synced: 2025-09-13T02:36:21.476Z (8 months ago)
- Topics: go, golang, markdown, markup-language, mathml, syntax-highlighting
- Language: Go
- Homepage: https://noclaps.github.io/znak/
- Size: 632 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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).