debian-mirror-gitlab/lib/tasks/gitlab/banzai.rake

21 lines
618 B
Ruby
Raw Normal View History

2022-04-04 11:22:00 +05:30
# frozen_string_literal: true
namespace :gitlab do
namespace :banzai do
desc 'GitLab | Banzai | Render markdown using our FullPipeline (input will be requested)'
task render: :environment do |_t|
markdown = []
puts "\nEnter markdown below, Ctrl-D to end (if you need blank lines, paste in the full text):"
while buf = Readline.readline('', true)
markdown << buf
end
puts "Rendering using Gitlab's FullPipeline...\n\n"
html = MarkupHelper.markdown(markdown.join("\n"), { pipeline: :full, project: nil })
puts html.gsub('&#x000A;', "\n")
end
end
end