Skip to content

Commit

Permalink
Switch from redcarpet to kramdown for markdown rendering
Browse files Browse the repository at this point in the history
redcarpet can't deal with pipes in tables
vmg/redcarpet#477
  • Loading branch information
SimonWoolf committed Jan 6, 2025
1 parent 8930282 commit 64b2746
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gemfile do
source 'https://rubygems.org'
gem 'RedCloth', '~> 4.3.2'
gem 'ruby-handlebars', '~> 0.4.1'
gem 'redcarpet', '~> 3.6.0'
gem 'kramdown', '~> 2.4.0'
end
puts 'Gems installed and loaded.'

Expand Down Expand Up @@ -121,16 +121,14 @@ textile_file_names.each do |file_name|
puts "✓"
end

markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)

markdown_file_names.each do |file_name|
print "#{file_name} ... "

markdown_content = remove_frontmatter(File.read(File.join(SOURCE_PATH, file_name)))
.gsub(/\{\{\s*SPECIFICATION_VERSION\s*\}\}/, versions['specification'].to_s)
.gsub(/\{\{\s*PROTOCOL_VERSION\s*\}\}/, versions['protocol'].to_s)

bodyHtml = markdown.render(markdown_content)
bodyHtml = Kramdown::Document.new(markdown_content).to_html
plain_file_name = file_name.delete_suffix(MARKDOWN_EXTENSION)
is_root = (plain_file_name == ROOT_SOURCE_NAME)
html = template.call({
Expand Down

0 comments on commit 64b2746

Please sign in to comment.