diff options
| author | 2023-10-30 11:07:17 +0100 | |
|---|---|---|
| committer | 2023-10-30 11:07:17 +0100 | |
| commit | 2a4b26ed202759388f86ce6adfb2dcf471f42d4a (patch) | |
| tree | ac08ef4d6c69f94ea263811fd2ec7ef302861f7e /vendor/github.com/yuin/goldmark/extension | |
| parent | [chore]: Bump github.com/tdewolff/minify/v2 from 2.19.10 to 2.20.0 (#2316) (diff) | |
| download | gotosocial-2a4b26ed202759388f86ce6adfb2dcf471f42d4a.tar.xz | |
[chore]: Bump github.com/yuin/goldmark from 1.5.6 to 1.6.0 (#2318)
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.5.6 to 1.6.0.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.5.6...v1.6.0)
---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/yuin/goldmark/extension')
| -rw-r--r-- | vendor/github.com/yuin/goldmark/extension/cjk.go | 34 | ||||
| -rw-r--r-- | vendor/github.com/yuin/goldmark/extension/tasklist.go | 3 |
2 files changed, 30 insertions, 7 deletions
diff --git a/vendor/github.com/yuin/goldmark/extension/cjk.go b/vendor/github.com/yuin/goldmark/extension/cjk.go index 14bcde1e1..a3238c20c 100644 --- a/vendor/github.com/yuin/goldmark/extension/cjk.go +++ b/vendor/github.com/yuin/goldmark/extension/cjk.go @@ -9,11 +9,30 @@ import ( // A CJKOption sets options for CJK support mostly for HTML based renderers. type CJKOption func(*cjk) +// A EastAsianLineBreaks is a style of east asian line breaks. +type EastAsianLineBreaks int + +const ( + //EastAsianLineBreaksNone renders line breaks as it is. + EastAsianLineBreaksNone EastAsianLineBreaks = iota + // EastAsianLineBreaksSimple is a style where soft line breaks are ignored + // if both sides of the break are east asian wide characters. + EastAsianLineBreaksSimple + // EastAsianLineBreaksCSS3Draft is a style where soft line breaks are ignored + // even if only one side of the break is an east asian wide character. + EastAsianLineBreaksCSS3Draft +) + // WithEastAsianLineBreaks is a functional option that indicates whether softline breaks // between east asian wide characters should be ignored. -func WithEastAsianLineBreaks() CJKOption { +// style defauts to [EastAsianLineBreaksSimple] . +func WithEastAsianLineBreaks(style ...EastAsianLineBreaks) CJKOption { return func(c *cjk) { - c.EastAsianLineBreaks = true + if len(style) == 0 { + c.EastAsianLineBreaks = EastAsianLineBreaksSimple + return + } + c.EastAsianLineBreaks = style[0] } } @@ -25,7 +44,7 @@ func WithEscapedSpace() CJKOption { } type cjk struct { - EastAsianLineBreaks bool + EastAsianLineBreaks EastAsianLineBreaks EscapedSpace bool } @@ -34,7 +53,9 @@ var CJK = NewCJK(WithEastAsianLineBreaks(), WithEscapedSpace()) // NewCJK returns a new extension with given options. func NewCJK(opts ...CJKOption) goldmark.Extender { - e := &cjk{} + e := &cjk{ + EastAsianLineBreaks: EastAsianLineBreaksNone, + } for _, opt := range opts { opt(e) } @@ -42,9 +63,8 @@ func NewCJK(opts ...CJKOption) goldmark.Extender { } func (e *cjk) Extend(m goldmark.Markdown) { - if e.EastAsianLineBreaks { - m.Renderer().AddOptions(html.WithEastAsianLineBreaks()) - } + m.Renderer().AddOptions(html.WithEastAsianLineBreaks( + html.EastAsianLineBreaks(e.EastAsianLineBreaks))) if e.EscapedSpace { m.Renderer().AddOptions(html.WithWriter(html.NewWriter(html.WithEscapedSpace()))) m.Parser().AddOptions(parser.WithEscapedSpace()) diff --git a/vendor/github.com/yuin/goldmark/extension/tasklist.go b/vendor/github.com/yuin/goldmark/extension/tasklist.go index dc86c374f..4467ebfff 100644 --- a/vendor/github.com/yuin/goldmark/extension/tasklist.go +++ b/vendor/github.com/yuin/goldmark/extension/tasklist.go @@ -41,6 +41,9 @@ func (s *taskCheckBoxParser) Parse(parent gast.Node, block text.Reader, pc parse return nil } + if parent.HasChildren() { + return nil + } if _, ok := parent.Parent().(*gast.ListItem); !ok { return nil } |
