Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#398: Update asciidoc-writers-guide.adoc #655

Closed
wants to merge 1 commit into from

Conversation

hemanik
Copy link

@hemanik hemanik commented Mar 15, 2017

Added tip to include relative link to a file in a sub directory using xref inline macro.
issue:#398

Added tip to include relative link to a file in a sub directory using xref inline macro.
@hemanik hemanik changed the title Update asciidoc-writers-guide.adoc #398: Update asciidoc-writers-guide.adoc Mar 15, 2017
@@ -366,6 +366,8 @@ include::{includedir}/xref.adoc[]

include::{includedir}/xref-relative.adoc[]

TIP: The xref inline macro by default resolves the link to HTML, to create a relative link to an asciidoc file in another subdirectory include `ifdef::env-github[:outfilesuffix: .adoc]` below the document header and drop the ".adoc" extension after the filename.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a method which is more neutral (support any output or source format). I canimagine there are more edit environents than GitHub?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ecki, Thanks for pointing out, it shouldn't indeed be limited to just GitHub.
I am not aware of any generic way, will explore and update the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's important to note that the xref macro only links to another file if the target ends in a hash suffix (e.g., # or #anchor-name). The # is how Asciidoctor distinguishes between an internal xref and an external xref.

Is there a method which is more neutral (support any output or source format).

The env-* attributes are set by the integrations. For example, the code that runs on GitHub (and GitLab) sets the env-github attribute. You should expect that each integration has a similar attribute. For example, Awestruct sets env-site. We've tried to introduce generic attributes where possible, but in some cases like GitHub, the environment is so unique that it really only applies to that specific integration.

Btw, the browser previews also need the outfilesuffix to be .adoc. Both the Chrome and Firefox plugin set this value by default now. You can also use env-browser in those environments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, we'll want to document all these environment attributes in the user manual. At the time of this writing, they are still evolving.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see outfilesuffix set to .adoc by default on GitHub. There's an issue tracking that change. See github/markup#519

@mojavelinux
Copy link
Member

I incorporated this into 731a287.

This is now the default behavior on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants