Class: Jekyll::Embed::Content
- Inherits:
-
Object
- Object
- Jekyll::Embed::Content
- Defined in:
- lib/jekyll/embed/content.rb
Class Method Summary collapse
-
.embed(content) ⇒ String
Find URLs on paragraphs.
Class Method Details
.embed(content) ⇒ String
Find URLs on paragraphs. We do it after rendering because sometimes we use HTML instead of pure Markdown and this way we catch both.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/embed/content.rb', line 15 def (content) Nokogiri::HTML5.fragment(content).tap do |html| html.css('p > a').each do |a| next unless a.parent.children.size == 1 next unless a['href'] == a.text.strip = Jekyll::Embed. a['href'] next if a['href'] == a.parent.replace end end.to_s end |