• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang blackfriday.Markdown函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/russross/blackfriday.Markdown函数的典型用法代码示例。如果您正苦于以下问题:Golang Markdown函数的具体用法?Golang Markdown怎么用?Golang Markdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Markdown函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: markdownRender

func markdownRender(ctx *RenderingContext) []byte {
	if ctx.RenderTOC {
		return blackfriday.Markdown(ctx.Content,
			getHTMLRenderer(blackfriday.HTML_TOC, ctx),
			getMarkdownExtensions(ctx))
	}
	return blackfriday.Markdown(ctx.Content, getHTMLRenderer(0, ctx),
		getMarkdownExtensions(ctx))
}
开发者ID:digitalcraftsman,项目名称:hugo,代码行数:9,代码来源:content.go


示例2: main

func main() {
	flag.Parse()

	args := flag.Args()

	renderer := &Console{}
	extensions := 0 |
		blackfriday.EXTENSION_NO_INTRA_EMPHASIS |
		blackfriday.EXTENSION_FENCED_CODE |
		blackfriday.EXTENSION_AUTOLINK |
		blackfriday.EXTENSION_STRIKETHROUGH |
		blackfriday.EXTENSION_SPACE_HEADERS |
		blackfriday.EXTENSION_HEADER_IDS |
		blackfriday.EXTENSION_BACKSLASH_LINE_BREAK |
		blackfriday.EXTENSION_DEFINITION_LISTS

	if len(args) > 0 {
		for i := 0; i < len(args); i++ {
			input, err := ioutil.ReadFile(args[i])
			if err != nil {
				os.Stderr.WriteString(fmt.Sprintf("mdcat: %s: unable to read from file\n", args[i]))
				os.Exit(1)
			}

			output := blackfriday.Markdown(input, renderer, extensions)
			os.Stdout.Write(output)
		}
	} else {
		reader := bufio.NewReader(os.Stdin)

		var input []byte
		buffer := make([]byte, 2<<20)

		for {
			count, err := reader.Read(buffer)

			if count == 0 {
				break
			}

			if err != nil {
				os.Stderr.WriteString("mdcat: unable to read from pipe\n")
				os.Exit(1)
			}

			input = append(input, buffer...)
		}

		output := blackfriday.Markdown(input, renderer, extensions)
		os.Stdout.Write(output)
	}

}
开发者ID:samfoo,项目名称:mdcat,代码行数:53,代码来源:mdcat.go


示例3: RenderPost

func (post *PostModel) RenderPost(postId string) *Post {
	result := post.Get(postId)
	renderer := blackfriday.HtmlRenderer(post.html_flags, "", "")
	if result.Type == 1 {
		result.Content = string(blackfriday.Markdown([]byte(result.Content), renderer, post.extensions))
	}

	// Also render all blog comments as markdown
	for i, v := range result.Comments {
		result.Comments[i].Content = string(blackfriday.Markdown([]byte(v.Content), renderer, post.extensions))
	}
	return result
}
开发者ID:JessonChan,项目名称:bloody.go,代码行数:13,代码来源:posts.go


示例4: markdownFile

func markdownFile(path string) (string, error) {
	if input, err := ioutil.ReadFile(path); err == nil {
		htmlFlags := 0
		htmlFlags |= blackfriday.HTML_USE_XHTML
		htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
		htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
		renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")

		// set up the parser
		extensions := 0
		extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
		extensions |= blackfriday.EXTENSION_TABLES
		extensions |= blackfriday.EXTENSION_FENCED_CODE
		extensions |= blackfriday.EXTENSION_AUTOLINK
		extensions |= blackfriday.EXTENSION_STRIKETHROUGH
		extensions |= blackfriday.EXTENSION_SPACE_HEADERS
		extensions |= blackfriday.EXTENSION_FOOTNOTES

		data := blackfriday.Markdown(input, renderer, extensions)
		return string(data), nil
	} else {
		return "", err
	}
}
开发者ID:thnguyn2,项目名称:WebGPU,代码行数:25,代码来源:machine_problem.go


示例5: RenderRaw

// RenderRaw renders Markdown to HTML without handling special links.
func RenderRaw(body []byte, urlPrefix string) []byte {
	htmlFlags := 0
	htmlFlags |= blackfriday.HTML_SKIP_STYLE
	htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
	renderer := &Renderer{
		Renderer:  blackfriday.HtmlRenderer(htmlFlags, "", ""),
		urlPrefix: urlPrefix,
	}

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	if setting.Markdown.EnableHardLineBreak {
		extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
	}

	body = blackfriday.Markdown(body, renderer, extensions)
	return body
}
开发者ID:ChamberJin,项目名称:gogs,代码行数:27,代码来源:markdown.go


示例6: Markdown

// Markdown renders GitHub Flavored Markdown text.
func Markdown(text []byte) []byte {
	htmlFlags := 0
	renderer := &renderer{Html: blackfriday.HtmlRenderer(htmlFlags, "", "").(*blackfriday.Html)}

	// Parser extensions for GitHub Flavored Markdown.
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	//extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK

	unsanitized := blackfriday.Markdown(text, renderer, extensions)

	// GitHub Flavored Markdown-like sanitization policy.
	p := bluemonday.UGCPolicy()
	p.AllowAttrs("class").Matching(bluemonday.SpaceSeparatedTokens).OnElements("div", "span")
	p.AllowAttrs("class", "name").Matching(bluemonday.SpaceSeparatedTokens).OnElements("a")
	p.AllowAttrs("rel").Matching(regexp.MustCompile(`^nofollow$`)).OnElements("a")
	p.AllowAttrs("aria-hidden").Matching(regexp.MustCompile(`^true$`)).OnElements("a")
	p.AllowDataURIImages()

	return p.SanitizeBytes(unsanitized)
}
开发者ID:guus-vanweelden,项目名称:zedlist,代码行数:27,代码来源:markdown.go


示例7: RenderPost

// RenderPost runs the input source through the blackfriday library.
func RenderPost(post *Post, input []byte, page PageParams) ([]byte, error) {
	tpl, err := page.getTemplate("post")
	if err != nil {
		return nil, err
	}

	content := blackfriday.Markdown(
		input,
		blackfriday.HtmlRenderer(page.Blog.GetMarkdownHTMLOptions(), "", ""),
		page.Blog.GetMarkdownExtensions())

	page.Title = post.Title
	params := PostPageParams{
		Post:       post,
		Content:    string(content),
		PageParams: page,
	}

	buf := new(bytes.Buffer)
	if err := tpl.Execute(buf, params); err != nil {
		return nil, err
	}

	return wrapPage(buf.Bytes(), params.PageParams)
}
开发者ID:rsesek,项目名称:blackblog,代码行数:26,代码来源:render.go


示例8: RenderMarkdown

func RenderMarkdown(input []byte) []byte {
	// set up the HTML renderer
	htmlFlags := 0
	htmlFlags |= blackfriday.HTML_USE_XHTML
	htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
	renderer := &renderer{
		Html: blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", blackfriday.HtmlRendererParameters{
			FootnoteReturnLinkContents: "↩",
		}).(*blackfriday.Html),
	}

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions |= blackfriday.EXTENSION_HEADER_IDS
	extensions |= blackfriday.EXTENSION_FOOTNOTES

	return blackfriday.Markdown(input, renderer, extensions)
}
开发者ID:rubenv,项目名称:sitegen,代码行数:27,代码来源:sitegen.go


示例9: MarkdownToTextNoMetadata

// MarkdownToTextNoMetadata is the same as MarkdownToText only skipping the
// detection and parsing of any leading metadata. If opts is nil the defaults
// will be used.
func MarkdownToTextNoMetadata(markdown []byte, opts *Options) []byte {
	opts = resolveOpts(opts)
	rend := &renderer{
		width:             opts.Width,
		color:             opts.Color,
		tableAlignOptions: opts.TableAlignOptions,
		headerPrefix:      opts.HeaderPrefix,
		headerSuffix:      opts.HeaderSuffix,
	}
	markdown = bytes.Replace(markdown, []byte("\n///\n"), []byte(""), -1)
	txt := blackfriday.Markdown(markdown, rend,
		blackfriday.EXTENSION_NO_INTRA_EMPHASIS|
			blackfriday.EXTENSION_TABLES|
			blackfriday.EXTENSION_FENCED_CODE|
			blackfriday.EXTENSION_AUTOLINK|
			blackfriday.EXTENSION_STRIKETHROUGH|
			blackfriday.EXTENSION_DEFINITION_LISTS)
	for rend.level > 0 {
		txt = append(txt, markIndentStop)
		rend.level--
	}
	if len(txt) > 0 {
		txt = bytes.Replace(txt, []byte(" \n"), []byte(" "), -1)
		txt = bytes.Replace(txt, []byte("\n"), []byte(" "), -1)
		txt = reflow(txt, opts.Indent1, opts.Indent2, rend.width)
		txt = bytes.Replace(txt, []byte{markNBSP}, []byte(" "), -1)
		txt = bytes.Replace(txt, []byte{markLineBreak}, []byte("\n"), -1)
	}
	return txt
}
开发者ID:getcfs,项目名称:cfs-binary-release,代码行数:33,代码来源:blackfridaytext.go


示例10: renderItemBegin

//渲染评论HTML代码
func (cl CommentNode) renderItemBegin(b *bytes.Buffer, sortType string) {
	if cl.Status == 2 {
		cl.Content = "[已删除]"
	}
	b.WriteString(fmt.Sprintf(`<div id="cm-%d" class="cm" data-id="%v">
<div class="vt">
 <a class="icon-thumbs-up up" href="javascript:"></a>
 <a class="icon-thumbs-down down" href="javascript:"></a>
</div>
<div class="ct">
 <div class="uif">
   <a class="ep" href="javascript:">[–]</a>
   <a href="/user/%v">%v</a>
   <i class="v" title="↑%v ↓%v">%v分</i> <i class="t">%v</i>
 </div>
 <div class="tx">%s</div>
 <div class="ed">
   <a href="/link/permacoment/%v/%v/?cm_order=%s" class="cbtn">查看</a>
   <a href="javascript:" class="cbtn rp">回复</a>
 </div>`, cl.Id, cl.Id,
		cl.UserId, cl.UserName,
		cl.VoteUp, cl.VoteDown,
		cl.VoteUp-cl.VoteDown,
		cl.SinceTime(), blackfriday.Markdown([]byte(cl.Content), renderer, extensions), //strings.Replace(cl.Content, "\n", "<br/>", -1),
		cl.LinkId, cl.Id, sortType))
}
开发者ID:huwenshu,项目名称:ohlala,代码行数:27,代码来源:comment_sort.go


示例11: Render

// Renders markdown in submitted messages.
func Render(raw []byte) []byte {
	htmlFlags := 0
	htmlFlags |= blackfriday.HTML_USE_XHTML
	htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS

	escaped := new(bytes.Buffer)
	template.HTMLEscape(escaped, raw)
	rendered := blackfriday.Markdown(escaped.Bytes(), renderer, extensions)
	enabled := true
	fmt.Println("Raw message:")
	fmt.Println(string(raw))
	if enabled {
		fmt.Println("Rendered message:")
		fmt.Println(string(rendered))
		return rendered
	}
	return raw
}
开发者ID:jordanorelli,项目名称:superchat,代码行数:30,代码来源:main.go


示例12: RenderMarkdown

func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
	// slow!
	//body := RenderSpecialLink(rawBytes, urlPrefix)
	body := rawBytes
	htmlFlags := 0
	// htmlFlags |= gfm.HTML_USE_XHTML
	// htmlFlags |= gfm.HTML_USE_SMARTYPANTS
	// htmlFlags |= gfm.HTML_SMARTYPANTS_FRACTIONS
	// htmlFlags |= gfm.HTML_SMARTYPANTS_LATEX_DASHES
	// htmlFlags |= gfm.HTML_SKIP_HTML
	htmlFlags |= gfm.HTML_SKIP_STYLE
	//htmlFlags |= gfm.HTML_SKIP_SCRIPT
	htmlFlags |= gfm.HTML_GITHUB_BLOCKCODE
	htmlFlags |= gfm.HTML_OMIT_CONTENTS
	// htmlFlags |= gfm.HTML_COMPLETE_PAGE
	renderer := &CustomRender{
		Renderer:  gfm.HtmlRenderer(htmlFlags, "", ""),
		urlPrefix: urlPrefix,
	}

	// set up the parser
	extensions := 0
	extensions |= gfm.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= gfm.EXTENSION_TABLES
	extensions |= gfm.EXTENSION_FENCED_CODE
	extensions |= gfm.EXTENSION_AUTOLINK
	extensions |= gfm.EXTENSION_STRIKETHROUGH
	extensions |= gfm.EXTENSION_HARD_LINE_BREAK
	extensions |= gfm.EXTENSION_SPACE_HEADERS
	extensions |= gfm.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	body = gfm.Markdown(body, renderer, extensions)
	return body
}
开发者ID:kennylixi,项目名称:dufu,代码行数:34,代码来源:markdown.go


示例13: markdown

func markdown(raw []byte) []byte {
	htmlFlags := 0
	htmlFlags |= blackfriday.HTML_USE_XHTML
	htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
	htmlFlags |= blackfriday.HTML_COMPLETE_PAGE

	renderer := &CustomRender{
		Renderer: blackfriday.HtmlRenderer(htmlFlags, "", ""),
	}

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	body := blackfriday.Markdown(raw, renderer, extensions)
	return body
}
开发者ID:EdzeronK,项目名称:gogsweb,代码行数:27,代码来源:models.go


示例14: RenderRawMarkdown

func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
	htmlFlags := 0
	// htmlFlags |= blackfriday.HTML_USE_XHTML
	// htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	// htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	// htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	// htmlFlags |= blackfriday.HTML_SKIP_HTML
	htmlFlags |= blackfriday.HTML_SKIP_STYLE
	// htmlFlags |= blackfriday.HTML_SKIP_SCRIPT
	// htmlFlags |= blackfriday.HTML_GITHUB_BLOCKCODE
	htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
	// htmlFlags |= blackfriday.HTML_COMPLETE_PAGE
	renderer := &CustomRender{
		Renderer:  blackfriday.HtmlRenderer(htmlFlags, "", ""),
		urlPrefix: urlPrefix,
	}

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	if setting.Markdown.EnableHardLineBreak {
		extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
	}

	body = blackfriday.Markdown(body, renderer, extensions)
	return body
}
开发者ID:nafrente,项目名称:gogs,代码行数:34,代码来源:markdown.go


示例15: Markdown

// Markdown formats input using a plain-text renderer, and
// then returns up to the first `wordcount` words as a summary.
func Markdown(input []byte, wordcount int) []byte {
	words := bytes.Fields(blackfriday.Markdown(input, renderer{}, 0))
	if wordcount > len(words) {
		wordcount = len(words)
	}
	return bytes.Join(words[0:wordcount], []byte{' '})
}
开发者ID:FiloSottile,项目名称:caddy,代码行数:9,代码来源:summary.go


示例16: renderMarkdown

func renderMarkdown(appDir string, path string, markdownContent string, jsonContent map[string]interface{}) {
	renderer, extensions := configureBlackFriday(path)
	content := blackfriday.Markdown([]byte(markdownContent), renderer, extensions)

	re2 := regexp.MustCompile("/content/")
	src := []byte(path)
	replacement := []byte("/views/")
	htmlPath := re2.ReplaceAll(src, replacement)
	template, _ := loadHTML(appDir, string(htmlPath))

	result, err := ParseAndInsert(appDir, string(content), jsonContent, template)
	if err != nil {
		log.Fatal(err)
	}

	re := regexp.MustCompile("/content/(.+)")
	if matches := re.FindStringSubmatch(path); matches != nil && len(matches) == 2 {
		oldPath := matches[1]
		//tmpPath is the expected location before some manipulation around the filename, e.g. convert
		// blah.fuel to blah.html
		tmpPath := fmt.Sprintf("%s/public/%s", appDir, oldPath)
		//convert from .fuel to .html
		newDir, newPath := convertFromFuelToHTML(tmpPath)
		//make the new dir in public
		os.MkdirAll(newDir, 0777)
		//output is a []byte -- write it to a file
		ioutil.WriteFile(newPath, []byte(result), 0644)
	}
}
开发者ID:fblecha,项目名称:fuel,代码行数:29,代码来源:run.go


示例17: RenderMarkdown

func RenderMarkdown(mdStr string) string {
	htmlFlags := 0
	htmlFlags |= blackfriday.HTML_USE_XHTML
	// htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
	// htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	// htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	htmlFlags |= blackfriday.HTML_SKIP_HTML
	htmlFlags |= blackfriday.HTML_SKIP_STYLE
	htmlFlags |= blackfriday.HTML_SKIP_SCRIPT
	htmlFlags |= blackfriday.HTML_GITHUB_BLOCKCODE
	htmlFlags |= blackfriday.HTML_OMIT_CONTENTS
	htmlFlags |= blackfriday.HTML_COMPLETE_PAGE
	renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")

	// set up the parser
	extensions := 0
	extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	extensions |= blackfriday.EXTENSION_TABLES
	extensions |= blackfriday.EXTENSION_FENCED_CODE
	extensions |= blackfriday.EXTENSION_AUTOLINK
	extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
	extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	body := blackfriday.Markdown([]byte(mdStr), renderer, extensions)

	return string(body)
}
开发者ID:bamboolsu,项目名称:omi-Blog,代码行数:29,代码来源:markdown.go


示例18: RenderMarkdownSafe

func RenderMarkdownSafe(input []byte) []byte {
	// set up the HTML renderer
	flags := 0
	flags |= blackfriday.HTML_USE_XHTML
	flags |= blackfriday.HTML_USE_SMARTYPANTS
	flags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
	flags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
	flags |= blackfriday.HTML_SKIP_HTML
	flags |= blackfriday.HTML_SKIP_SCRIPT
	flags |= blackfriday.HTML_SKIP_STYLE
	// flags |= blackfriday.HTML_TOC
	// flags |= blackfriday.HTML_GITHUB_BLOCKCODE
	renderer := blackfriday.HtmlRenderer(flags, "", "")

	// set up the parser
	ext := 0
	ext |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
	ext |= blackfriday.EXTENSION_TABLES
	ext |= blackfriday.EXTENSION_FENCED_CODE
	ext |= blackfriday.EXTENSION_AUTOLINK
	ext |= blackfriday.EXTENSION_STRIKETHROUGH
	ext |= blackfriday.EXTENSION_SPACE_HEADERS
	ext |= blackfriday.EXTENSION_HARD_LINE_BREAK
	ext |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

	return blackfriday.Markdown(input, renderer, ext)
}
开发者ID:jbenet,项目名称:datadex,代码行数:27,代码来源:markdown.go


示例19: html

func (p *Post) html() (T.HTML, error) {
	body, err := p.withImages()
	if err != nil {
		return "", err
	}
	extensions := md.EXTENSION_SPACE_HEADERS | md.EXTENSION_TABLES | md.EXTENSION_NO_INTRA_EMPHASIS | md.EXTENSION_STRIKETHROUGH | md.EXTENSION_FOOTNOTES
	renderer := md.HtmlRenderer(0, "", "")
	return T.HTML(md.Markdown([]byte(body), renderer, extensions)), nil
}
开发者ID:darkhelmet,项目名称:blargh,代码行数:9,代码来源:post.go


示例20: Markdown

/*
Process a subset of markdown elements and prints them with flying colours!
*/
func Markdown(input []byte) []byte {
	tr := NewTerminalRenderer()
	ret := blackfriday.Markdown(input, tr, blackfriday.EXTENSION_STRIKETHROUGH)
	//get rid of \n at the end of the text
	for len(ret) > 0 && ret[len(ret)-1] == '\n' {
		ret = ret[:len(ret)-1]
	}
	return ret
}
开发者ID:capitancambio,项目名称:blackterm,代码行数:12,代码来源:render.go



注:本文中的github.com/russross/blackfriday.Markdown函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang blackfriday.MarkdownBasic函数代码示例发布时间:2022-05-28
下一篇:
Golang blackfriday.HtmlRendererWithParameters函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap