Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Grossetie <ggrossetie@gmail.com>2019-06-19 09:37:48 +0300
committerGuillaume Grossetie <ggrossetie@gmail.com>2019-07-02 10:24:05 +0300
commit5854537f117042d6a26b75d00284b9b37b6b8130 (patch)
tree7af3308e702968dc5d1ab6797380299b22fd05be /lib/gitlab/asciidoc
parent02ad0c2f6aedfe5053a79b027cc2882115c1cad5 (diff)
Enable AsciiDoc syntax highlighting (using Rouge)
Diffstat (limited to 'lib/gitlab/asciidoc')
-rw-r--r--lib/gitlab/asciidoc/syntax_highlighter/html_pipeline_adapter.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/asciidoc/syntax_highlighter/html_pipeline_adapter.rb b/lib/gitlab/asciidoc/syntax_highlighter/html_pipeline_adapter.rb
new file mode 100644
index 00000000000..5fc3323f0fd
--- /dev/null
+++ b/lib/gitlab/asciidoc/syntax_highlighter/html_pipeline_adapter.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Asciidoc
+ module SyntaxHighlighter
+ class HtmlPipelineAdapter < Asciidoctor::SyntaxHighlighter::Base
+ register_for 'gitlab-html-pipeline'
+
+ def format(node, lang, opts)
+ %(<pre><code #{lang ? %[ lang="#{lang}"] : ''}>#{node.content}</code></pre>)
+ end
+ end
+ end
+ end
+end