redcarpet

How to extend redcarpet to support auto linking user mentions?

青春壹個敷衍的年華 提交于 2019-12-18 13:27:24
问题 On my rails3 application I want to use redcarpet to handle user's posts and the user comment section. As such I'd like to extend redcarpet to support turning @username into a link to a user on my site. I know redcarpet is written in C but is there anyway easy way to extend it in ruby? How hard would it be to write it in C? Should I just do this outside of redcarpet? Also I'm intrested in some other extensions of redcarpet that would be shorthand for linking to other models in my app. I'm not

Syntax highlighting markdown code blocks in Jekyll (without using liquid tags)

别说谁变了你拦得住时间么 提交于 2019-12-17 15:27:11
问题 It seems like syntax highlighting in Jekyll is limited to using liquid tags and pygments like so: {% highlight bash %} cd ~ {% endhighlight %} But I've imported my existing blog from wordpress and it was written in markdown (using markdown code blocks) and I don't want to have to go through each post and fix the code blocks. Also, I want to keep my posts in pure markdown format in case I ever need to switch blogging platforms again. I switched my Jekyll parser to redcarpet with the hope that

Jekyll, modify the way some html tags are rendered

☆樱花仙子☆ 提交于 2019-12-10 21:39:57
问题 I would like to modify the way some html tags are rendered on jekyll. What I need is to add some css classes automatically (in this case the ".table" class to the table html tag). I'm using the redcarpet markdown processor. I suppose I need to write a plugin that extends the renderer but I can't find any good example... I came up with this but it's just a copy/paste job and it doesn't work... require 'redcarpet' class BootstrapTables < Redcarpet::Render::HTML def table(header, body) "\n<table

:footnotes extension won't work in Redcarpet Ruby gem

こ雲淡風輕ζ 提交于 2019-12-08 02:26:31
问题 I must be missing something very obvious -- I can't get footnotes to work with redcarpet. I have version 3.0.0: > gem list redcarpet *** LOCAL GEMS *** redcarpet (3.0.0) I am trying code from the test code on the Github repo that has footnotes and it won't convert the Markdown to HTML that contains the footnote. I reduced the code down to just the footnotes function and put it on Gist. The output is simply as follows: <p>This is a footnote.[^1]</p> <p>[^1]: It provides additional information.

Markdown Line Breaks in Code Blocks

馋奶兔 提交于 2019-12-07 02:16:51
问题 Using Redcarpet, when I include something like the following in my markdown, it does not respect any line breaks or indention. I've tried two spaces at the end of lines. Extra lines between code. Nothing seems to work. ```xml <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> ``` I see: <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> Here are the Redcarpet settings: Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after

:footnotes extension won't work in Redcarpet Ruby gem

女生的网名这么多〃 提交于 2019-12-06 13:38:54
I must be missing something very obvious -- I can't get footnotes to work with redcarpet. I have version 3.0.0: > gem list redcarpet *** LOCAL GEMS *** redcarpet (3.0.0) I am trying code from the test code on the Github repo that has footnotes and it won't convert the Markdown to HTML that contains the footnote. I reduced the code down to just the footnotes function and put it on Gist . The output is simply as follows: <p>This is a footnote.[^1]</p> <p>[^1]: It provides additional information.</p> What am I missing here? I have had this problem as well. It looks like the Rubygem needs to be

Using ERB in Markdown with Redcarpet

岁酱吖の 提交于 2019-12-06 05:13:43
问题 I'm trying to get Markdown to play nicely with .erb. I'd like to use high_voltage to render markdown pages (or normal .html.erb files with markdown partials) that are parsed with Redcarpet and am struggling to get it to all work together. At the moment I have an initializer called markdown_template_handler.rb that contains the following code: class MarkdownTemplateHandler def erb @erb ||= ActionView::Template.registered_template_handler(:erb) end def call(template) compiled_source = erb.call

Markdown Line Breaks in Code Blocks

本秂侑毒 提交于 2019-12-05 06:58:13
Using Redcarpet, when I include something like the following in my markdown, it does not respect any line breaks or indention. I've tried two spaces at the end of lines. Extra lines between code. Nothing seems to work. ```xml <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> ``` I see: <?xml version="1.0" encoding="UTF-8"?> <hash> <money>3</money> </hash> Here are the Redcarpet settings: Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true, :fenced_code_blocks => true, :no_intra_emphasis => true, :lax_html_blocks => true) What do

How to render table with Redcarpet and Markdown

余生长醉 提交于 2019-12-03 06:48:10
问题 I'm trying to render a table like this with Redcarpet | header 1 | header 2 | | -------- | -------- | | cell 1 | cell 2 | | cell 3 | cell 4 | but it's not working. Is it possible to render a table with Redcarpet ? 回答1: Yes, you can render a table like that, but you have to enable the :tables option. require 'redcarpet' markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :tables => true) text = <<END | header 1 | header 2 | | -------- | -------- | | cell 1 | cell 2 | | cell 3 | cell 4

Table not render when use Redcarpet in Jekyll GitHub Pages?

折月煮酒 提交于 2019-12-03 02:16:35
问题 As of maruku engine (the default), writing table like surround text, etc. | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 | surround text... would render correctly. But when I switch to redcarpet (add markdown: redcarpet into _config.yml ), the table no longer rendered, both localhost and on GitHub Pages. Did I do something wrong? 回答1: Adding only markdown: redcarpet into