mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-26 20:14:43 +01:00
Enable writing plain text straight to output
It's only used in a single place and should probably be refactored away, but this workaround is OK for now.
This commit is contained in:
parent
114d6b0d68
commit
97235182ac
4
html.go
4
html.go
@ -187,6 +187,10 @@ func (r *Html) CopyWrites(processor func()) []byte {
|
|||||||
return output.Bytes()
|
return output.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Html) Write(b []byte) (int, error) {
|
||||||
|
return r.w.Write(b)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Html) GetResult() []byte {
|
func (r *Html) GetResult() []byte {
|
||||||
return r.w.output.Bytes()
|
return r.w.output.Bytes()
|
||||||
}
|
}
|
||||||
|
@ -748,7 +748,7 @@ func autoLink(p *parser, data []byte, offset int) int {
|
|||||||
|
|
||||||
anchorStr := anchorRe.Find(data[anchorStart:])
|
anchorStr := anchorRe.Find(data[anchorStart:])
|
||||||
if anchorStr != nil {
|
if anchorStr != nil {
|
||||||
out.Write(anchorStr[offsetFromAnchor:]) // XXX: write in parser?
|
p.r.Write(anchorStr[offsetFromAnchor:]) // XXX: write in parser?
|
||||||
return len(anchorStr) - offsetFromAnchor
|
return len(anchorStr) - offsetFromAnchor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
latex.go
4
latex.go
@ -60,6 +60,10 @@ func (r *Latex) CopyWrites(processor func()) []byte {
|
|||||||
return output.Bytes()
|
return output.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Latex) Write(b []byte) (int, error) {
|
||||||
|
return r.w.Write(b)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Latex) GetResult() []byte {
|
func (r *Latex) GetResult() []byte {
|
||||||
return r.w.output.Bytes()
|
return r.w.output.Bytes()
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,7 @@ type Renderer interface {
|
|||||||
GetFlags() HtmlFlags
|
GetFlags() HtmlFlags
|
||||||
CaptureWrites(processor func()) []byte
|
CaptureWrites(processor func()) []byte
|
||||||
CopyWrites(processor func()) []byte
|
CopyWrites(processor func()) []byte
|
||||||
|
Write(b []byte) (int, error)
|
||||||
GetResult() []byte
|
GetResult() []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user