redcarpet

The safe Markdown parser, reloaded.

MIT License

Downloads
91.5M
Stars
5K
Committers
112

Bot releases are hidden (Show)

redcarpet - Redcarpet v3.6.0 Latest Release

Published by robin850 over 1 year ago

This release is not particularly heavy but brings a few improvements and fixes.

Improvements

  • Avoid warnings running on Ruby 3.2+ (See #721).
  • Consider <center> as a block-level element (See #702).
  • Properly provide a third argument to the table_cell callback indicating whether the current cell is part of the header or not.
    The previous implementation with two parameters is still supported (See #604 and #605).

Fixes

  • Match fence char and length when matching closing fence in fenced code blocks (Fixes #208).
  • Fix anchor generation on titles with ampersands (Fixes #696).
redcarpet - Redcarpet v3.5.1

Published by robin850 almost 4 years ago

Fix a security vulnerability using :quote in combination with the :escape_html option.

Reported by Johan Smits.

redcarpet -

Published by robin850 about 5 years ago

This release mostly ships with bug fixes and tiny improvements.

Improvements

  • Avoid mutating the options hash passed to a render object (See #663).

  • Automatically enable the fenced_code_blocks option passing a HTML_TOC object to the Markdown object's constructor since some languages rely on the sharp to comment code (See #451).

  • Remove the rel and rev attributes from the output generated for footnotes as they don't pass the HTML 5 validation (See #536).

  • Allow passing Range objects to the nesting_level option to have a higher level of customization for table of contents (See #519):

    Redcarpet::Render::HTML_TOC.new(nesting_level: 2..5)
    

Bug fixes

  • Fix a segfault rendering quotes using StripDown and the :quote option.

  • Fix SmartyPants single quotes right after a link. For example:

    [John](http://john.doe)'s cat
    

    Will now properly converts ' to a right single quote (i.e. ).

redcarpet -

Published by robin850 almost 8 years ago

Redcarpet v3.4.0

This new release ships with a bunch of bug fixes especially regarding anchor generation.

Improvements to anchor generation

The anchor generation now relies on a djb2 hashing algorithm whenever the generated anchor is empty as non alpha-numeric chars. This is specifically interesting for CJK contents as Redcarpet used to generate empty anchors dealing with titles in these locales.

Special thanks to Alexey Kopytko and namusyaka for their work on that !

Also now, the html-escaped entities are removed from anchors generated with the HTML render in order to be consistent with the HTML_TOC render and as it is more expected.

Other improvements

  • Table headers don't require a minimum of three dashes anymore; a single one can be used for each row.
  • The Markdown and rendering options are now exposed through a Hash inside the @options instance variable inside your custom render objects.

Bug fixes

  • Multiple single quote pairs are parsed correctly with SmartyPants.
  • Remove periods at the end of URLs when autolinking to make sure
    that links at the end of a sentence get properly generated.
  • Avoid escaping ampersands in href links.

Checkout the CHANGELOG for further information and changes.

redcarpet - Redcarpet 3.3.4

Published by robin850 almost 9 years ago

This release simply fixes the bufprintf function to correctly work on Windows MinGW-w64 so strings are properly written to the buffer and also skips non-ASCII chars during anchor generation to avoid generating invalid UTF-8 bytes sequences.

redcarpet - Redcarpet 3.3.1

Published by robin850 over 9 years ago

As of version 3.3.0, the provided redcarpet executable no longer worked since it relies on a new Redcarpet::CLI class that wasn't available because its file wasn't included in the gemspec. This version fixes this.

redcarpet - Redcarpet 3.3.0

Published by robin850 over 9 years ago

Redcarpet v3.3.0

This new release ships with a bunch of bug fixes and improvements especially regarding anchor generation.

Improvements to anchors

The anchor generation algorithm has been improved. It now correctly strips out non-alphanumeric chars from the generated string ; it tries as much as possible to match the behavior of the Active Support's #parameterize method.

Moreover, Redcarpet used to HTML-escape anchors rendered through the HTMl_TOC render. This is no longer the case but if you want this behavior back for any reason, you can now pass the :escape_html option instantiating the object.

Redcarpet's command line interface

The plain old Ruby file that was provided as a bin script now relies on a brand new API that you can use and that uses Ruby's OptionParser.

This allows you to create custom scripts for your needs. You can handle the provided files as you want and add new options or fall-backs (e.g. an option to use Pygments). Read the documentation of the Redcarpet::CLI class for further information.

Undeprecate the RedCloth API compatibility layer

This release actually un-deprecates the RedCloth API compatibility layer. Since Redcarpet provides a different API than most processors, it turned out that this layer is used in libraries that provide support for different Markdown parsers.

Bug fixes

As usual, some bugs have been fixed:

  • Avoid parsing images when the given URL isn't safe and the :safe_links_only option is enabled.
  • Add the lang- prefix in front of the language's name when using :prettify along with :fenced_code_blocks.

Check out the CHANGELOG for further information.

redcarpet - Redcarpet 3.2.3

Published by robin850 over 9 years ago

This release of Redcarpet fixes a security issue relying on auto-linking by preventing any rewinding of a previous inline like an emphasis when auto-linking another one like an e-mail address.

Also this release ships with a fix when escaping forward slashes with the Safe render object (there was a missing semi-colon).

redcarpet - Redcarpet 3.2.2

Published by robin850 almost 10 years ago

This release of Redcarpet is another patch release for the 3.2 series that addresses a regression that would wrap<script> tags inside paragraphs. See vmg/redcarpet#440 for further details.

redcarpet - Redcarpet 3.2.1

Published by robin850 almost 10 years ago

This release of Redcarpet is meant to address a backward incompatibility between version 3.1 and 3.2. Since the RedCloth API layer has been deprecated, the RedcarpetCompat class has been wrongly moved to the redcarpet/compat file but the class wasn't available when the file wasn't explicitly required.

This version fixes this requiring that file by default when Redcarpet gets loaded.

redcarpet - Redcarpet 3.2.0

Published by robin850 about 10 years ago

Redcarpet v3.2.0

New features

Updates to the StripDown render

The StripDown render object will now handle images and correctly display links' URL. For instance:

Here's a ![squirrel](shipit.png) !

And an external [link](https://github.com).

Will now render to:

Here's a squirrel shipit.png !

And an external link (https://github.com) !

Introducing the Safe render

In order to safely deal with users' input for instance, Redcarpet now ships with a Redcarpet::Render::Safe object.

The :safe_links_only and :escape_html options are turned on by default. It also has a custom block_code callback since by default the specified language will be set as the class of the rendered code block.

Redcarpet::Markdown.new(Redcarpet::Render::Safe)

HTML5 block-level elements recognition

HTML5 blocks-level elements are now recognized so that they will not be included under a paragraph.

Deprecation

The Redcarpet's compatibility layer for the old RedCloth API has been deprecated. If you are still relying on it, please do update your code to rely on the new API.

This layer will be removed any time Redcarpet reaches 4.0.

Bug fixes

Some bug fixes have also been applied:

  • In-page links (with anchors) are now parsed when the :safe_links_only option is enabled (#372)
  • Trailing single quotes are now correctly converted to curly quotes using Smarty Pants (#340)
  • The equal sign (=) can now be escaped (e.g. when using the :highlight option) (#369)

Check out the CHANGELOG for further information.

redcarpet - Redcarpet 3.1.2

Published by robin850 over 10 years ago

Redcarpet v3.1.2

This release remove the yielding of the anchor parameter when overriding the header callback. This change has been introduced in 3.1.0 but this was a breaking change for people upgrading from 3.0.0. We are sorry for the inconvenience !

redcarpet - Redcarpet 3.1.1

Published by mattr- over 10 years ago

Redcarpet v3.1.1

This release of Redcarpet is meant to address a serious bug when rendering text that contains headings and contains all the prior enhancements of Redcarpet 3.1.0. For more information about Redcarpet 3.1.0, please see the release notes

Bug fixes

Fix a crash when rendering text that contained an anchor.

redcarpet - Redcarpet 3.1.0

Published by robin850 over 10 years ago

Redcarpet version 3.1.0

It's been a long time since since we've released any version of Redcarpet but we are happy to announce the release of the version 3.1.0. Over 100 commits have been added since 3.0.0 with some new exciting features.

New features

Footnotes

This has been requested for a while but this is finally here. Redcarpet now ships with a :footnotes option for the Markdown object to allow you to use PHP-Markdown footnotes:

Markdown[^1] rocks!

[^1] : http://daringfireball.net/projects/markdown/

You can override the output through the #footnote_def, #footnote_ref and #footnotes callbacks. Thanks to the contributors of this feature!

GitHub style anchors

Previously, passing the :with_toc_data option to a render object would generate ids according to the order of apparition of the headers (e.g. toc_0). The anchors are now humanized to improve the output so your table of contents are cleaner and more "SEO-friendly".

Also, by default, any markup is stripped out from the id:

# This is really **cool**

will generate:

<h1 id="this-is-really-cool">This is really <strong>cool</strong></h1>

The :quote option

A :quote option has been added for the Markdown object and allows you to render quotation marks to <q> tags. You can override this output through the #quote callback.

Bug fixes

Apart from the new features, a few bugs have been fixed:

  • Fix code blocks' classes when using Google code prettify #314
  • Follow the standard to detect when new paragraph is outside last item #111
  • Make ordered lists preceded by paragraph parsed with :lax_spacing #311
  • Allow using tabs between a reference's colon and its link #337

Please see the changelog for further information.

redcarpet - Redcarpet 3.0.0

Published by mattr- over 11 years ago

Robin, Vicent ,and I are happy to announce the release of Redcarpet 3.0.0! We've got the usual line up of goodies to talk about, so let's get to the good stuff.

Backwards Compatibility

We've removed support for Ruby 1.8.x in this release. If you still need Ruby 1.8.x support, then you'll need to stick with Redcarpet 2.3.0.

We've also removed the sundown submodule that was included in the Redcarpet codebase. Sundown has been deprecated for some time and all the code has been included in the redcarpet repository for awhile as well. So long Sundown and thanks for all the fish.

New features

Highlight support

We've got a new option you can pass to the Redcarpet::Markdown object: :highlight. This feature will let you use wrap a bit of text in a pair of equals signs and Redcarpet will generate markup that will cause it to be highlighted. If you want to use this option, you can use the following Ruby code:

markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :highlight => true)

to render the following markdown

This is ==highlighted== text, yo.

as

This is <mark>highlighted</mark> text, yo.

Thanks to Sam Soffes for contributing this. If you want to see it in action before you give it a try, check out Sam's blog.

Bug fixes

We've fixed several issues in the Redcarpet codebase in this release. Here are some of the highlights:

  • Fixed an issue where mixing code spans and emphasis mangled the output (#135 and #190)
  • Fixed an issue where nested parenthesis in a link didn't render correctly (#237)
  • Fixed an issue where FTP URIs were misidentified as email links when using autolinking (#170)
  • Fixed an issue where emphasis inside parenthesis was not parsed correctly (#256)
  • Fixed an issue where HTML comments were being needlessly escaped (#268)

Thanks to Robin Dupret for fixing all of these!

Wrapping this up

We're really excited about Redcarpet 3.0.0 and hope you enjoy using it as much as we enjoyed making it. If you have any issues, please feel free to file an issue and we'll take a look at it.

Thanks!

Package Rankings
Top 0.33% on Rubygems.org
Top 4.11% on Proxy.golang.org
Top 7.11% on Alpine-v3.3
Badges
Extracted from project README
Build status Help Contribute to Open Source Gem Version