Set Asciidoctor outfilesuffix to default .adoc

Without setting outfilesuffix Asciidoctor defaults to .html. When .html is used,
inter-document cross references do not work in Gitlab's repository / file renderer.
See more information from
http://asciidoctor.org/docs/user-manual/#navigating-between-source-files
and
http://asciidoctor.org/docs/user-manual/#inter-document-cross-references
This commit is contained in:
Turo Soisenniemi 2018-02-14 19:41:13 +00:00
parent dd633bc188
commit 9a450aedc2
3 changed files with 15 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Asciidoc now support inter-document cross references between files in repository
merge_request: 17125
author: Turo Soisenniemi
type: changed

View file

@ -8,7 +8,8 @@ module Gitlab
module Asciidoc
DEFAULT_ADOC_ATTRS = [
'showtitle', 'idprefix=user-content-', 'idseparator=-', 'env=gitlab',
'env-gitlab', 'source-highlighter=html-pipeline', 'icons=font'
'env-gitlab', 'source-highlighter=html-pipeline', 'icons=font',
'outfilesuffix=.adoc'
].freeze
# Public: Converts the provided Asciidoc markup into HTML.

View file

@ -95,6 +95,14 @@ module Gitlab
expect(render(input, context)).to include('<p><code data-math-style="inline" class="code math js-render-math">2+2</code> is 4</p>')
end
end
context 'outfilesuffix' do
it 'defaults to adoc' do
output = render("Inter-document reference <<README.adoc#>>", context)
expect(output).to include("a href=\"README.adoc\"")
end
end
end
def render(*args)