# Paths for my project on GitHub
[/] <-> [/naoty] <-> [/naoty/graphdown]
[/] <-> [/naoty/graphdown]
[/] <-> [/search] -> [/naoty/graphdown]
[/] <-> [/notifications] -> [/naoty/graphdown]
This text should not be parsed.
[sample link](http://example.com)
# Sign in and Sign out on GitHub
[/] -[POST /logout]-> [/]
[/] -> [/login] -[POST /session]-> [/]
This text should not be parsed.
Last active
January 4, 2016 16:19
-
-
Save naoty/8646605 to your computer and use it in GitHub Desktop.
paragraph parse sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "redcarpet" | |
| require "pathname" | |
| require "cgi" | |
| class MyRenderer < Redcarpet::Render::HTML | |
| def paragraph(text) | |
| if text =~ /^\s?\[.+\]\s?$/ | |
| puts "parses:" | |
| lines = text.split("\n") | |
| lines.each do |line| | |
| puts "\t#{CGI.unescapeHTML(line)}" | |
| end | |
| "" | |
| else | |
| %(<p>#{text}</p>) | |
| end | |
| end | |
| end | |
| markdown = Redcarpet::Markdown.new(MyRenderer) | |
| content = Pathname.new("./sample.md").read | |
| markdown.render(content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment