diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 19b539b1..c1ff0bd1 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -28,8 +28,18 @@ end markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content| + attributes = { + 'showtitle' => '@', + 'idprefix' => '', + 'idseparator' => '-', + 'docname' => File.basename(filename, (extname = File.extname(filename))), + 'outfilesuffix' => extname, + 'env' => 'github', + 'env-github' => '', + 'source-highlighter' => 'html-pipeline' + } Asciidoctor::Compliance.unique_id_start_index = 1 - Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- outfilesuffix=.adoc env=github env-github source-highlighter=html-pipeline)) + Asciidoctor.convert(content, :safe => :secure, :attributes => attributes) end command( diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index 6b5c49d0..d3c872f7 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -7,7 +7,7 @@ Refer to <> or <>. -Navigate to <>. +Navigate from {docname}{outfilesuffix} to <>. == Another Section diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index cd8fe8c1..6f478cab 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -16,7 +16,7 @@

First Section

Refer to Another Section or Another Section.

-

Navigate to another document.

+

Navigate from README.asciidoc to another document.