1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-discord.git synced 2024-11-01 12:24:15 +00:00

Minor tweaks in formatting

This commit is contained in:
diamondburned 2020-07-08 14:23:14 -07:00
parent 601e8abeb2
commit e08c31b895
4 changed files with 14 additions and 3 deletions

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.14
require (
github.com/diamondburned/arikawa v0.9.6
github.com/diamondburned/cchat v0.0.42
github.com/diamondburned/ningen v0.1.1-0.20200708090333-227e90d19851
github.com/diamondburned/ningen v0.1.1-0.20200708211706-57c712372ede
github.com/dustin/go-humanize v1.0.0
github.com/go-test/deep v1.0.6
github.com/pkg/errors v0.9.1

2
go.sum
View file

@ -49,6 +49,8 @@ github.com/diamondburned/ningen v0.1.1-0.20200708085949-b64e350f3b8c h1:3h/kyk6H
github.com/diamondburned/ningen v0.1.1-0.20200708085949-b64e350f3b8c/go.mod h1:FNezDLQIhoDS+RkXLSQ7dJNrt6BW/nVl1krzDgWMQwg=
github.com/diamondburned/ningen v0.1.1-0.20200708090333-227e90d19851 h1:xf1aLPnwK/Yn2z7dBIgQROSVOEc2wtivgnnwBItdEVM=
github.com/diamondburned/ningen v0.1.1-0.20200708090333-227e90d19851/go.mod h1:FNezDLQIhoDS+RkXLSQ7dJNrt6BW/nVl1krzDgWMQwg=
github.com/diamondburned/ningen v0.1.1-0.20200708211706-57c712372ede h1:qRmfQCOS+ZnH4G0+8O09PUx3HQTdQwzsDoo1ucTgm2E=
github.com/diamondburned/ningen v0.1.1-0.20200708211706-57c712372ede/go.mod h1:FNezDLQIhoDS+RkXLSQ7dJNrt6BW/nVl1krzDgWMQwg=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=

View file

@ -13,8 +13,9 @@ var _ text.Quoteblocker = (*BlockquoteSegment)(nil)
func (r *TextRenderer) blockquote(n *ast.Blockquote, enter bool) ast.WalkStatus {
if enter {
r.startBlock()
defer r.endBlock()
// Block formatting.
r.ensureBreak()
defer r.ensureBreak()
// Create a segment.
var seg = BlockquoteSegment{start: r.buf.Len()}

View file

@ -7,6 +7,7 @@ import (
"github.com/diamondburned/arikawa/discord"
"github.com/diamondburned/arikawa/state"
"github.com/diamondburned/cchat-discord/urlutils"
"github.com/diamondburned/cchat/text"
"github.com/diamondburned/ningen/md"
"github.com/dustin/go-humanize"
)
@ -48,6 +49,13 @@ func (r *TextRenderer) renderEmbed(embed discord.Embed, m *discord.Message, s st
start, end := r.writeString(embed.Title)
r.ensureBreak()
// Make the title bold.
r.append(InlineSegment{
start: start,
end: end,
attributes: text.AttrBold,
})
if embed.URL != "" {
r.append(LinkSegment{
start,