Update markdown module

This commit is contained in:
Roman Volosovskyi 2020-10-19 13:31:37 +03:00
parent 4ecca1169d
commit a36144983a
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
6 changed files with 49 additions and 9 deletions

View File

@ -1 +1 @@
0.62.11
0.62.12

2
go.mod
View File

@ -51,7 +51,7 @@ require (
github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a
github.com/status-im/doubleratchet v3.0.0+incompatible
github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e // indirect
github.com/status-im/markdown v0.0.0-20200210164614-b9fe92168122
github.com/status-im/markdown v0.0.0-20201019100609-fdf2b9595723
github.com/status-im/migrate/v4 v4.6.2-status.2
github.com/status-im/rendezvous v1.3.0
github.com/status-im/status-go/extkeys v1.1.2

4
go.sum
View File

@ -652,8 +652,8 @@ github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Od
github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e h1:iT/UJdf+SzbgkIPDe/RmlCfLEQ+ab4UMl6toBl9CGZA=
github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/status-im/markdown v0.0.0-20200210164614-b9fe92168122 h1:q18rWqbHHXZGKPAIuvlb2wAAA3XzlMbkEey2bhKf8GY=
github.com/status-im/markdown v0.0.0-20200210164614-b9fe92168122/go.mod h1:9yR8woqkJIHs3sf9pEjYvaGfmhsXR1leEMAX6+Z5y+M=
github.com/status-im/markdown v0.0.0-20201019100609-fdf2b9595723 h1:knqBM/gX4XxsIpX1clXEl8oMYc5KBcgmdLyZEvMJAMk=
github.com/status-im/markdown v0.0.0-20201019100609-fdf2b9595723/go.mod h1:9yR8woqkJIHs3sf9pEjYvaGfmhsXR1leEMAX6+Z5y+M=
github.com/status-im/migrate/v4 v4.6.2-status.2 h1:SdC+sMDl/aI7vUlwD2qj2p7KsK4T60IS9z4/rYCCbI8=
github.com/status-im/migrate/v4 v4.6.2-status.2/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8=
github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4=

View File

@ -382,11 +382,44 @@ func (c *Strong) MarshalJSON() ([]byte, error) {
return json.Marshal(&c1)
}
// StrongEmph represents markdown strong emphasis node
type StrongEmph struct {
Leaf
}
func (c *StrongEmph) MarshalJSON() ([]byte, error) {
type StrongJSON struct {
Type string `json:"type"`
Literal string `json:"literal"`
*Attribute
}
var c1 StrongJSON
c1.Literal = string(c.Literal)
c1.Attribute = c.Attribute
c1.Type = "strong-emph"
return json.Marshal(&c1)
}
// Del represents markdown del node
type Del struct {
Leaf
}
func (c *Del) MarshalJSON() ([]byte, error) {
type StrongJSON struct {
Type string `json:"type"`
Literal string `json:"literal"`
*Attribute
}
var c1 StrongJSON
c1.Literal = string(c.Literal)
c1.Attribute = c.Attribute
c1.Type = "del"
return json.Marshal(&c1)
}
// Link represents markdown link node
type Link struct {
Container

View File

@ -1164,7 +1164,14 @@ func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
emph := &ast.Emph{}
emph.Literal = data[:i]
return i + 1, emph
var node ast.Node = emph
if p.extensions&SuperSubscript == 0 && c == '~' {
del := &ast.Del{}
del.Literal = data[:i]
node = del
}
return i + 1, node
}
}
@ -1217,9 +1224,9 @@ func helperTripleEmphasis(p *Parser, data []byte, offset int, c byte) (int, ast.
switch {
case i+2 < len(data) && data[i+1] == c && data[i+2] == c:
// triple symbol found
strong := &ast.Strong{}
strong.Literal = data[:i]
return i + 3, strong
strongEmph := &ast.StrongEmph{}
strongEmph.Literal = data[:i]
return i + 3, strongEmph
case i+1 < len(data) && data[i+1] == c:
// double symbol found, hand over to emph1
length, node := helperEmphasis(p, origData[offset-2:], c)

2
vendor/modules.txt vendored
View File

@ -366,7 +366,7 @@ github.com/status-im/doubleratchet
github.com/status-im/go-multiaddr-ethv4
# github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e
github.com/status-im/keycard-go/derivationpath
# github.com/status-im/markdown v0.0.0-20200210164614-b9fe92168122
# github.com/status-im/markdown v0.0.0-20201019100609-fdf2b9595723
github.com/status-im/markdown
github.com/status-im/markdown/ast
github.com/status-im/markdown/parser