require "spec_helper" require "middleman-hashicorp/extension" module Middleman::HashiCorp describe RedcarpetHTML do it "adds links to code list elements" do markdown = <<-EOH.gsub(/^ {8}/, "") This is a list: - `one` - `two` has some `code` inside - `three has ^ and spaces` with text - four EOH output = <<-EOH.gsub(/^ {8}/, "")

This is a list:

EOH expect(markdown).to render_html(output) end it "adds links to code list elements when they have newlines" do markdown = <<-EOH.gsub(/^ {8}/, "") This is a list: - `one` - `two` has some `code` inside - `three has ^ and spaces` with text - four EOH output = <<-EOH.gsub(/^ {8}/, "")

This is a list:

EOH expect(markdown).to render_html(output) end it "does not add links if they already exist" do markdown = <<-EOH.gsub(/^ {8}/, "") - [`/one`](#link_one): Some text - [`/two`](#link_two) - `three` is a regular auto-link - [`/four`](#link_four) - Same as one but with a - EOH output = <<-EOH.gsub(/^ {8}/, "") EOH expect(markdown).to render_html(output) end it "adds links to unordered lists with unrelated content links" do markdown = <<-EOH.gsub(/^ {8}/, "") - `one` - `two` - has a [link_two](#link_two) inside - `three`: is regular but with a colon EOH output = <<-EOH.gsub(/^ {8}/, "") EOH expect(markdown).to render_html(output) end it "supports markdown inside HTML" do markdown = <<-EOH.gsub(/^ {8}/, "") This is some markdown
**Here** is some _html_ though! ;)
EOH output = <<-EOH.gsub(/^ {8}/, "")

This is some markdown

Here is some html though! ;)

EOH expect(markdown).to render_html(output) end it "uses the proper options for recursive markdown" do markdown = <<-EOH.gsub(/^ {8}/, "") This is some markdown
**Here** is some _html_ though! ;) no_intra_emphasis still applies, as does ~~strikethrough~~.
EOH output = <<-EOH.gsub(/^ {8}/, "")

This is some markdown

Here is some html though! ;)

no_intra_emphasis still applies, as does strikethrough.

EOH expect(markdown).to render_html(output) end it "supports alert boxes" do markdown = <<-EOH.gsub(/^ {8}/, "") => This is a success note -> This is an info note ~> This is a _warning_ note !> This is a danger note And this is a regular paragraph! EOH output = <<-EOH.gsub(/^ {8}/, "")

And this is a regular paragraph!

EOH expect(markdown).to render_html(output) end it "supports TOC data" do markdown = <<-EOH.gsub(/^ {8}/, "") # Hello World ## Subpath EOH output = <<-EOH.gsub(/^ {8}/, "")

Hello World

Subpath

EOH expect(markdown).to render_html(output) end it "supports fenced code blocks" do markdown = <<-EOH.gsub(/^ {8}/, "") ```ruby puts "hi" ``` EOH output = <<-EOH.gsub(/^ {8}/, "")
puts "hi"
        
EOH expect(markdown).to render_html(output) end end end