[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6560":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":28,"discoverSource":29},6560,"redcarpet","vmg\u002Fredcarpet","vmg","The safe Markdown parser, reloaded.","",null,"C",5080,532,91,98,0,2,5,39.18,"MIT License",false,"master",true,[],"2026-06-12 02:01:26","Redcarpet is written with sugar, spice and everything nice\n============================================================\n\n[![Build status](https:\u002F\u002Fgithub.com\u002Fvmg\u002Fredcarpet\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fvmg\u002Fredcarpet\u002Factions\u002Fworkflows\u002Ftest.yml)\n[![Help Contribute to Open Source](https:\u002F\u002Fwww.codetriage.com\u002Fvmg\u002Fredcarpet\u002Fbadges\u002Fusers.svg)](https:\u002F\u002Fwww.codetriage.com\u002Fvmg\u002Fredcarpet)\n[![Gem Version](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fredcarpet.svg)](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fredcarpet)\n\nRedcarpet is a Ruby library for Markdown processing that smells like\nbutterflies and popcorn.\n\nThis library is written by people\n---------------------------------\n\nRedcarpet was written by [Vicent Martí](https:\u002F\u002Fgithub.com\u002Fvmg). It is maintained by\n[Robin Dupret](https:\u002F\u002Fgithub.com\u002Frobin850) and [Matt Rogers](https:\u002F\u002Fgithub.com\u002Fmattr-).\n\nRedcarpet would not be possible without the [Sundown](https:\u002F\u002Fwww.github.com\u002Fvmg\u002Fsundown)\nlibrary and its authors (Natacha Porté, Vicent Martí, and its many awesome contributors).\n\nYou can totally install it as a Gem\n-----------------------------------\n\nRedcarpet is readily available as a Ruby gem. It will build some native\nextensions, but the parser is standalone and requires no installed libraries.\nStarting with Redcarpet 3.0, the minimum required Ruby version is 1.9.2 (or Rubinius in 1.9 mode).\n\n    $ [sudo] gem install redcarpet\n\nIf you need to use it with Ruby 1.8.7, you will have to stick with 2.3.0:\n\n    $ [sudo] gem install redcarpet -v 2.3.0\n\nThe Redcarpet source is available at GitHub:\n\n    $ git clone git:\u002F\u002Fgithub.com\u002Fvmg\u002Fredcarpet.git\n\n\nAnd it's like *really* simple to use\n------------------------------------\n\nThe core of the Redcarpet library is the `Redcarpet::Markdown` class. Each\ninstance of the class is attached to a `Renderer` object; the Markdown class\nperforms parsing of a document and uses the attached renderer to generate\noutput.\n\nThe `Redcarpet::Markdown` object is encouraged to be instantiated once with the\nrequired settings, and reused between parses.\n\n~~~~ ruby\n# Initializes a Markdown parser\nmarkdown = Redcarpet::Markdown.new(renderer, extensions = {})\n~~~~\n\nHere, the `renderer` variable refers to a renderer object, inheriting\nfrom `Redcarpet::Render::Base`. If the given object has not been\ninstantiated, the library will do it with default arguments.\n\nRendering with the `Markdown` object is done through `Markdown#render`.\nUnlike in the RedCloth API, the text to render is passed as an argument\nand not stored inside the `Markdown` instance, to encourage reusability.\nExample:\n\n~~~~ ruby\nmarkdown.render(\"This is *bongos*, indeed.\")\n# => \"\u003Cp>This is \u003Cem>bongos\u003C\u002Fem>, indeed.\u003C\u002Fp>\"\n~~~~\n\nYou can also specify a hash containing the Markdown extensions which the\nparser will identify. The following extensions are accepted:\n\n* `:no_intra_emphasis`: do not parse emphasis inside of words.\nStrings such as `foo_bar_baz` will not generate `\u003Cem>` tags.\n\n* `:tables`: parse tables, PHP-Markdown style.\n\n* `:fenced_code_blocks`: parse fenced code blocks, PHP-Markdown\nstyle. Blocks delimited with 3 or more `~` or backticks will be considered\nas code, without the need to be indented. An optional language name may\nbe added at the end of the opening fence for the code block.\n\n* `:autolink`: parse links even when they are not enclosed in `\u003C>`\ncharacters. Autolinks for the http, https and ftp protocols will be\nautomatically detected. Email addresses and http links without protocol,\nbut starting with `www` are also handled.\n\n* `:disable_indented_code_blocks`: do not parse usual markdown\ncode blocks. Markdown converts text with four spaces at\nthe front of each line to code blocks. This option\nprevents it from doing so. Recommended to use\nwith `fenced_code_blocks: true`.\n\n* `:strikethrough`: parse strikethrough, PHP-Markdown style.\nTwo `~` characters mark the start of a strikethrough,\ne.g. `this is ~~good~~ bad`.\n\n* `:lax_spacing`: HTML blocks do not require to be surrounded by an\nempty line as in the Markdown standard.\n\n* `:space_after_headers`: A space is always required between the hash\nat the beginning of a header and its name, e.g. `#this is my header`\nwould not be a valid header.\n\n* `:superscript`: parse superscripts after the `^` character; contiguous superscripts\nare nested together, and complex values can be enclosed in parenthesis, e.g.\n`this is the 2^(nd) time`.\n\n* `:underline`: parse underscored emphasis as underlines.\n`This is _underlined_ but this is still *italic*`.\n\n* `:highlight`: parse highlights.\n`This is ==highlighted==`. It looks like this: `\u003Cmark>highlighted\u003C\u002Fmark>`\n\n* `:quote`: parse quotes.\n`This is a \"quote\"`. It looks like this: `\u003Cq>quote\u003C\u002Fq>`\n\n* `:footnotes`: parse footnotes, PHP-Markdown style. A footnote works very much\nlike a reference-style link: it consists of a  marker next to the text (e.g.\n`This is a sentence.[^1]`) and a footnote definition on its own line anywhere\nwithin the document (e.g. `[^1]: This is a footnote.`).\n\nExample:\n\n~~~~ ruby\nmarkdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)\n~~~~\n\nDarling, I packed you a couple renderers for lunch\n--------------------------------------------------\n\nRedcarpet comes with two built-in renderers, `Redcarpet::Render::HTML` and\n`Redcarpet::Render::XHTML`, which output HTML and XHTML, respectively. These\nrenderers are actually implemented in C and hence offer brilliant\nperformance — several degrees of magnitude faster than other Ruby Markdown\nsolutions.\n\nAll the rendering flags that previously applied only to HTML output have\nnow been moved to the `Redcarpet::Render::HTML` class, and may be enabled when\ninstantiating the renderer:\n\n~~~~ ruby\nRedcarpet::Render::HTML.new(render_options = {})\n~~~~\n\nInitializes an HTML renderer. The following flags are available:\n\n* `:filter_html`: do not allow any user-inputted HTML in the output.\n\n* `:no_images`: do not generate any `\u003Cimg>` tags.\n\n* `:no_links`: do not generate any `\u003Ca>` tags.\n\n* `:no_styles`: do not generate any `\u003Cstyle>` tags.\n\n* `:escape_html`: escape any HTML tags. This option has precedence over\n`:no_styles`, `:no_links`, `:no_images` and `:filter_html` which means\nthat any existing tag will be escaped instead of being removed.\n\n* `:safe_links_only`: only generate links for protocols which are considered\nsafe.\n\n* `:with_toc_data`: add HTML anchors to each header in the output HTML,\nto allow linking to each section.\n\n* `:hard_wrap`: insert HTML `\u003Cbr>` tags inside paragraphs where the original\nMarkdown document had newlines (by default, Markdown ignores these newlines).\n\n* `:xhtml`: output XHTML-conformant tags. This option is always enabled in the\n`Render::XHTML` renderer.\n\n* `:prettify`: add prettyprint classes to `\u003Ccode>` tags for google-code-prettify.\n\n* `:link_attributes`: hash of extra attributes to add to links.\n\nExample:\n\n~~~~ ruby\nrenderer = Redcarpet::Render::HTML.new(no_links: true, hard_wrap: true)\n~~~~\n\n\nThe `HTML` renderer has an alternate version, `Redcarpet::Render::HTML_TOC`,\nwhich will output a table of contents in HTML based on the headers of the\nMarkdown document.\n\nWhen instantiating this render object, you can optionally pass a `nesting_level`\noption which takes an integer or a range and allows you to make it render only\nheaders at certain levels.\n\nRedcarpet also includes a plaintext renderer, `Redcarpet::Render::StripDown`, that\nstrips out all the formatting:\n\n~~~~ ruby\nrequire 'redcarpet'\nrequire 'redcarpet\u002Frender_strip'\n\nmarkdown = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)\n\nmarkdown.render(\"**This** _is_ an [example](http:\u002F\u002Fexample.org\u002F).\")\n# => \"This is an example (http:\u002F\u002Fexample.org\u002F).\"\n~~~~\n\n\nAnd you can even cook your own\n------------------------------\n\nCustom renderers are created by inheriting from an existing renderer. The\nbuilt-in renderers, `HTML` and `XHTML` may be extended as such:\n\n~~~~ ruby\n# Create a custom renderer that sets a custom class for block-quotes.\nclass CustomRender \u003C Redcarpet::Render::HTML\n  def block_quote(quote)\n    %(\u003Cblockquote class=\"my-custom-class\">#{quote}\u003C\u002Fblockquote>)\n  end\nend\n\nmarkdown = Redcarpet::Markdown.new(CustomRender, fenced_code_blocks: true)\n~~~~\n\nBut new renderers can also be created from scratch by extending the abstract\nbase class `Redcarpet::Render::Base` (see `lib\u002Fredcarpet\u002Frender_man.rb` for\nan example implementation of a Manpage renderer):\n\n~~~~ ruby\nclass ManPage \u003C Redcarpet::Render::Base\n  # you get the drill -- keep going from here\nend\n~~~~\n\nThe following instance methods may be implemented by the renderer:\n\n### Block-level calls\n\nIf the return value of the method is `nil`, the block will be skipped.\nTherefore, make sure that your renderer has at least a `paragraph` method\nimplemented. If the method for a document element is not implemented, the\nblock will be skipped.\n\nExample:\n\n~~~~ ruby\nclass RenderWithoutCode \u003C Redcarpet::Render::HTML\n  def block_code(code, language)\n    nil\n  end\nend\n~~~~\n\n* block_code(code, language)\n* block_quote(quote)\n* block_html(raw_html)\n* footnotes(content)\n* footnote_def(content, number)\n* header(text, header_level)\n* hrule()\n* list(contents, list_type)\n* list_item(text, list_type)\n* paragraph(text)\n* table(header, body)\n* table_row(content)\n* table_cell(content, alignment, header)\n\n### Span-level calls\n\nA return value of `nil` will not output any data. If the method for\na document element is not implemented, the contents of the span will\nbe copied verbatim:\n\n* autolink(link, link_type)\n* codespan(code)\n* double_emphasis(text)\n* emphasis(text)\n* image(link, title, alt_text)\n* linebreak()\n* link(link, title, content)\n* raw_html(raw_html)\n* triple_emphasis(text)\n* strikethrough(text)\n* superscript(text)\n* underline(text)\n* highlight(text)\n* quote(text)\n* footnote_ref(number)\n\n**Note**: When overriding a renderer's method, be sure to return a HTML\nelement with a level that matches the level of that method (e.g. return a\nblock element when overriding a block-level callback). Otherwise, the output\nmay be unexpected.\n\n### Low level rendering\n\n* entity(text)\n* normal_text(text)\n\n### Header of the document\n\nRendered before any another elements:\n\n* doc_header()\n\n### Footer of the document\n\nRendered after all the other elements:\n\n* doc_footer()\n\n### Pre\u002Fpost-process\n\nSpecial callback: preprocess or postprocess the whole document before\nor after the rendering process begins:\n\n* preprocess(full_document)\n* postprocess(full_document)\n\nYou can look at\n[\"How to extend the Redcarpet 2 Markdown library?\"](https:\u002F\u002Fweb.archive.org\u002Fweb\u002F20170505231254\u002Fhttp:\u002F\u002Fdev.af83.com\u002F2012\u002F02\u002F27\u002Fhowto-extend-the-redcarpet2-markdown-lib.html)\nfor some more explanations.\n\nAlso, now our Pants are much smarter\n------------------------------------\n\nRedcarpet 2 comes with a standalone [SmartyPants](\nhttp:\u002F\u002Fdaringfireball.net\u002Fprojects\u002Fsmartypants\u002F) implementation. It is fully\ncompliant with the original implementation. It is the fastest SmartyPants\nparser there is, with a difference of several orders of magnitude.\n\nThe SmartyPants parser can be found in `Redcarpet::Render::SmartyPants`. It has\nbeen implemented as a module, so it can be used standalone or as a mixin.\n\nWhen mixed with a Renderer class, it will override the `postprocess` method\nto perform SmartyPants replacements once the rendering is complete.\n\n~~~~ ruby\n# Mixin\nclass HTMLWithPants \u003C Redcarpet::Render::HTML\n  include Redcarpet::Render::SmartyPants\nend\n\n# Standalone\nRedcarpet::Render::SmartyPants.render(\"\u003Cp>Oh SmartyPants, you're so crazy...\u003C\u002Fp>\")\n~~~~\n\nSmartyPants works on top of already-rendered HTML, and will ignore replacements\ninside the content of HTML tags and inside specific HTML blocks (`pre`, `code`,\n`var`, `samp`, `kbd`, `math`, `script`, `style`).\n\nWhat? You really want to mix Markdown renderers?\n------------------------------------------------\n\nRedcarpet used to be a drop-in replacement for Redcloth. This is no longer the\ncase since version 2 -- it now has its own API, but retains the old name. Yes,\nthat does mean that Redcarpet is not backwards-compatible with the 1.X\nversions.\n\nEach renderer has its own API and its own set of extensions: you should choose one\n(it doesn't have to be Redcarpet, though that would be great!), write your\nsoftware accordingly, and force your users to install it. That's the\nonly way to have reliable and predictable Markdown output on your program.\n\nMarkdown is already ill-specified enough; if you create software that is\nrenderer-independent, the results will be completely unreliable!\n\nStill, if major forces (let's say, tornadoes or other natural disasters) force you\nto keep a Markdown-compatibility layer, Redcarpet also supports this:\n\n~~~~ ruby\nrequire 'redcarpet\u002Fcompat'\n~~~~\n\nRequiring the compatibility library will declare a `Markdown` class with the\nclassical RedCloth API, e.g.\n\n~~~~ ruby\nMarkdown.new('this is my text').to_html\n~~~~\n\nThis class renders 100% standards compliant Markdown with 0 extensions. Nada.\nDon't even try to enable extensions with a compatibility layer, because\nthat's a maintenance nightmare and won't work.\n\nOn a related topic: if your Markdown gem has a `lib\u002Fmarkdown.rb` file that\nmonkeypatches the Markdown class, you're a terrible human being. Just saying.\n\nBoring legal stuff\n------------------\n\nCopyright (c) 2011-2016, Vicent Martí\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and\u002For sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","Redcarpet是一个用C语言编写的Markdown解析库，旨在提供安全可靠的Markdown处理功能。其核心特性包括支持多种Markdown扩展（如表格、代码块等），并通过Sundown库实现高效解析。此外，Redcarpet设计上强调了易用性和灵活性，允许用户通过配置不同的渲染器来定制输出格式。该库适用于需要将Markdown文本转换为HTML或其他格式的各种场景，特别是对于那些对安全性有较高要求的应用程序来说，Redcarpet是一个理想的选择。","2026-06-11 03:07:38","top_language"]