Every repository with this icon (
Every repository with this icon (
| Description: | Discount (For Ruby) Implementation of John Gruber's Markdown edit |
-
After installing via gems: gem install rdiscount
Invoking: rdiscount
Will yield:``ruby/18/gems/rdiscount-1.3.5/lib/rdiscount.bundle: dlopen(/.gem/ruby/18/gems/rdiscount-1.3.5/lib/rdiscount.bundle, 9): no suitable image found. Did find: (LoadError)
/.gem/ruby/18/gems/rdiscount-1.3.5/lib/rdiscount.bundle: mach-o, but wrong architecture - /.gem/ruby/18/gems/rdiscount-1.3.5/lib/rdiscount.bundle from /opt/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /.gem/ruby/18/gems/rdiscount-1.3.5/lib/rdiscount.rb:72 from /opt/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /opt/ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /.gem/ruby/18/gems/rdiscount-1.3.5/bin/rdiscount:4 from /.gem/ruby/18/bin/rdiscount:19:in `load' from /.gem/ruby/18/bin/rdiscount:19``Comments
-
Discount got a bunch of additional functionality since this extension was original created. Most of these require a bit to be set in the flags given to discount:
MKD_NO_EXT- do not process psuedo-protocolsMKD_NOLINKS- do not allow “<a” or expand “[][]” into a link.MKD_NOIMAGE- do not allow “<img” or expand “![][]” into an IMG tag.MKD_NOHEADER- do not process the document header, but treat it like regular text.MKD_STRICT- Disable relaxed emphasis and superscripts.MKD_AUTOLINK- Greedily expand links; if a url is encountered, convert it to a hyperlink even if it isn’t surrounded with<>sMKD_SAFELINK- Be paranoid about how “[][]” is expanded into a link — if the url isn’t a local reference, http://, https://, ftp://, or news://, it will not be converted into a hyperlink.MKD_NOTABLES- Don’t process PHP Markdown Extra tables.
See the discount page for more info.
Comments
-
0 comments Created 12 days ago by rtomaykoOrdered and unordered lists indentation more strict than Markdown.plupstreamxDiscount does not recognize subsequent paragraphs for lists indented with zero, one, or three characters.
The following is processed by
Markdown.plas one unordered lists with two list items, the last list item having three paragraphs:- foo bar baz - foo bar bazThis is equivelant:
- foo bar baz - foo bar bazDiscount treats it as one unordered list with two list items, the last including only the "foo" paragraph, and then "bar" and "baz" paragraphs as siblings of the unordered list.
Ordered lists have the same behavior.
Comments
-
0 comments Created 5 months ago by elmimmoReference links without subsequent bracketed reference do not workupstreamxWhile the Markdown specs say we should write reference links followed by empty brackets if the reference word is the same as the linked word, like
Google is a search engine
Gruberg writes them without the empty brackets, just like:
Yahoo is another search engine
Like in this article (seach for [previously]).
His Markdown Dingus and other markdown parsers such as WMD-Editor do behave this way.
Note: this issue was first posted to http://github.com/toland/qlmarkdown/issues/#issue/2 and then to http://support.github.com/discussions/gist/63-bugs-in-markdown-rendering, but both bugs seem to come from rdiscount.
Comments
-
1 comment Created 3 months ago by mojomboNon-newlines preceding pre tags break the pre formattingupstreamxThe two following invocations should result in identical pre tags.
>> RDiscount.new("\nthis is `a\\_test` and this\\_too\n
").to_html=> "\nthis is `a\\_test` and this\\_too\n
\n\n">> RDiscount.new("lol\nthis is `a\\_test` and this\\_too\n
").to_html=> "<p>lol\nthis is
\n"a\\_testand this_too\nComments
So this is one of the weirder corners of the markdown spec:
The only restrictions are that block-level HTML elements — e.g. ,
<table>,<pre>,<p>, etc. — must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted)<p>tags around HTML block-level tags.The
<p>tags in second example are correct. What I'm not sure about is when markdown formatting is supposed to be turned off. In the first example, it's clearly within a block level HTML tag, and so formatting is disabled. In the second example, the<pre>is considered an inline HTML tag and so markdown formatting is still turned on. Here's the relevant parts of the spec:Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style
*emphasis*inside an HTML block.And then:
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
As unintuitive as it seems, I think discount is probably doing the "right thing" here, per the markdown spec at least. Let me take a look at how Markdown.pl handles it.












Found a fix:
diff --git a/lib/rdiscount.rb b/lib/rdiscount.rb
index 2ce0b0d..c92da75 100644
--- a/lib/rdiscount.rb +++ b/lib/rdiscount.rb @@ -69,4 +69,4 @@ end
Markdown = RDiscount unless defined? Markdown
-require 'rdiscount.so' +require 'rdiscount' diff --git a/rdiscount.gemspec b/rdiscount.gemspec
index 61f16cd..126ffc4 100644
--- a/rdiscount.gemspec +++ b/rdiscount.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'rdiscount' s.version = '1.3.5' s.summary = "Fast Implementation of Gruber's Markdown in C" - s.date = '2009-07-26' + s.date = '2009-09-23' s.email = 'r@tomayko.com' s.homepage = 'http://github.com/rtomayko/rdiscount' s.has_rdoc = true
That probably doesn't actually fix it.
require 'rdiscount'brings in the ruby lib,require 'rdiscount.so'brings in the C extension. Changing it to 'rdiscount' is probably just causing the extension not to load at all.