summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/banzai.rake
blob: b1c7e4ea519f7ffcc49256d549aa78732bbccc60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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