Module: PreviewMarkdown

Extended by:
ActiveSupport::Concern
Included in:
GroupsController, ProjectsController, SnippetsController, WikiActions
Defined in:
app/controllers/concerns/preview_markdown.rb

Instance Method Summary collapse

Instance Method Details

#preview_markdownObject

rubocop:disable Gitlab/ModuleWithInstanceVariables


7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/concerns/preview_markdown.rb', line 7

def preview_markdown
  result = PreviewMarkdownService.new(@project, current_user, markdown_service_params).execute

  render json: {
    body: view_context.markdown(result[:text], markdown_context_params),
    references: {
      users: result[:users],
      suggestions: SuggestionSerializer.new.represent_diff(result[:suggestions]),
      commands: view_context.markdown(result[:commands])
    }
  }
end