goldmark-enclave
This goldmark extension extend commonmark syntax:
- uses Markdown's image syntax
![]() to support other objects.
- adds highlight syntax for inline text.
- adds title to links
- supports pandoc-style fenced divs in goldmark.
- supports github-style callouts in goldmark.
Full Demo
Live Demo
Embeded Objects
Supported Objects
Usage
import (
enclave "github.com/zeozeozeo/goldmark-enclave"
"github.com/yuin/goldmark"
)
// ...
markdown := goldmark.New(
goldmark.WithExtensions(
enclave.New(),
),
)
And then you can use it like this:
Youtube Video:

Bilibili Video:

Twitter Tweet:

TradingView Chart:

Quail List and Post


Image with caption and giving it a width:

Dify Widget

Spotify Embed

HTML5 Audio

Some Options
Some objects support options:
theme: The theme of the TradingView chart, twitter tweet and quaily widget. Default: light
- e.g.

width / w and height / h: The width and height of images. Default: auto
Image Size and Alignment
Obsidian-style image syntax
It supports two forms of Obsidian-style image syntax:

or

Units
To specify the unit of the width and height, you can use the following units:
px: pixels
rem: rem
%: percentage


Alignment
The align parameter is used to specify the alignment of the image. Supported values are left, right and center. The default value is center.

Other features
Highlight Text
import (
enclaveMark "github.com/zeozeozeo/goldmark-enclave/mark"
"github.com/yuin/goldmark"
)
// ...
markdown := goldmark.New(
goldmark.WithExtensions(
enclaveMark.New(),
),
)
This is a ==highlighted text==.
will be rendered as:
<p>This is a <mark>highlighted text</mark>.</p>
Title to Links
import (
enclaveHref "github.com/zeozeozeo/goldmark-enclave/href"
"github.com/yuin/goldmark"
)
// ...
markdown := goldmark.New(
goldmark.WithExtensions(
enclaveHref.New(&enclaveHref.Config{}),
),
)
[Quail](/blog "Quail Blog")
will be rendered as:
<a href="https://quaily.com/blog" title="Quail Blog">Quail</a>
Pandoc-style Fenced Divs
import (
enclaveFence "github.com/zeozeozeo/goldmark-enclave/fence"
"github.com/yuin/goldmark"
)
// ...
markdown := goldmark.New(
goldmark.WithExtensions(
enclaveFence.New(),
),
)
Callouts
import (
enclaveCallout "github.com/zeozeozeo/goldmark-enclave/callout"
"github.com/yuin/goldmark"
)
// ...
markdown := goldmark.New(
goldmark.WithExtensions(
enclaveCallout.New(),
),
)
Github-style
> [!NOTE]
> This is a note callout.
Simple
WARNING
This is a warning callout.
Simple Inline
WARNING: This is a warning callout.
Installation
go get github.com/zeozeozeo/goldmark-enclave