From b0be03670bcd8b554bb3294bb1b2cc3b7445cf73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Teichgr=C3=A4ber?= Date: Wed, 12 Jun 2013 14:20:19 +0200 Subject: [PATCH] Parser: add MarkdownString --- markdown.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/markdown.go b/markdown.go index 33fb1dd..c24d89e 100644 --- a/markdown.go +++ b/markdown.go @@ -96,6 +96,11 @@ func (p *Parser) Markdown(src io.Reader, f Formatter) { f.Finish() } +// MarkdownString is like Markdown, but takes a string argument instead of an io.Reader. +func (p *Parser) MarkdownString(src string, f Formatter) { + p.Markdown(strings.NewReader(src), f) +} + func (p *Parser) parseRule(rule int, s string) (tree *element) { old := p.yy.ResetBuffer(s) if old != "" && strings.Trim(old, "\r\n ") != "" {