gitea-tea/vendor/github.com/yuin/goldmark-emoji
Norwin 222d0501df Detect markdown line width, resolve relative URLs (#332)
~~this is semi-blocked by https://github.com/charmbracelet/glamour/pull/96, but behaviour isn't really worse than the previous behaviour (most links work, some are still broken)~~

#### testcase for link resolver
```
tea pr 332
tea checkout 332 && make install && tea pr 332
```

- [rel](./332)
- [abs](/gitea/tea/pulls/332)
- [full](https://gitea.com/gitea/tea/pulls/332)

Co-authored-by: Norwin Roosen <git@nroo.de>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/332
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
2021-03-12 20:28:46 +08:00
..
ast Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
definition Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
.gitignore Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
LICENSE Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
README.md Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
emoji.go Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
go.mod Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00
go.sum Detect markdown line width, resolve relative URLs (#332) 2021-03-12 20:28:46 +08:00

README.md

goldmark-emoji

GoDev

goldmark-emoji is an extension for the goldmark that parses :joy: style emojis.

Installation

go get github.com/yuin/goldmark-emoji

Usage

import (
    "bytes"
    "fmt"

    "github.com/yuin/goldmark"
    "github.com/yuin/goldmark-emoji"
    "github.com/yuin/goldmark-emoji/definition"
)

func main() {
    markdown := goldmark.New(
        goldmark.WithExtensions(
            emoji.Emoji,
        ),
    )
    source := `
    Joy :joy:
    `
    var buf bytes.Buffer
    if err := markdown.Convert([]byte(source), &buf); err != nil {
        panic(err)
    }
    fmt.Print(buf.String())
}

See emoji_test.go for detailed usage.

Options

Options for the extension

Option Description
WithEmojis Definition of emojis. This defaults to github emoji set
WithRenderingMethod Entity : renders as HTML entities, Twemoji : renders as an img tag that uses twemoji, Func : renders using a go function
WithTwemojiTemplate Twemoji img tag printf template
WithRendererFunc renders by a go function

License

MIT

Author

Yusuke Inuzuka