Login  Register

Re: Output to another folder, with image and css links

Posted by mojavelinux on Nov 26, 2018; 7:24am
URL: https://discuss.asciidoctor.org/Output-to-another-folder-with-image-and-css-links-tp6593p6614.html

The processor only converts AsciiDoc to HTML. It does not copy other files around. That's typically left up to a build tool like Gradle, Maven, or Antora.

You could, of course, open a feature request to have the export feature of the VS Code extension copy the related resources (e.g., images) to the output folder. Another option is to enable data-uri so that the images get embedded into the output document.

In short, when the target directory is different from the source directory, you (or the tool) have to take on the responsibliity of copying the related resources to that the the HTML file can be viewed properly.

Cheers,

-Dan

On Thu, Nov 22, 2018 at 9:18 PM tigregalis [via Asciidoctor :: Discussion] <[hidden email]> wrote:
First up, great project. I've been following it for a while and only starting to use it to any serious degree.

I'm using VS Code with the extension to edit and preview my document. Within VS Code, the preview works perfectly. When exporting, however, due to the output location (one directory up), the images try to resolve to one directory further up.

I'm just wondering how I can output to a HTML file at a different level, without breaking the links to images and the styles (i.e. the links adapting).

My structure is as follows:

manual/
* images/
** image1.png
** image2.gif
** ... (other images)
* source/
** index.adoc (root file)
** overview.adoc (included into index.adoc)
** structure.adoc (included into index.adoc)
** ... (other source files)
* styles
** custom.css
* output.html (output)

In each of the source files, when I reference an image, I use:
// go one folder up to "manual", then down to "images", then get "image1.png"
image::../images/image1.png[]

This is what I have at the top of index.adoc:
= Title
:toc: left
:experimental: true
:sectlinks:
// even though the stylesheet follows the same structure, the stylesheet works
:stylesheet: ../styles/custom.css
:linkcss:
// :imagesdir: ../images/
// I've tried this attribute but it doesn't appear to help, and I probably don't understand it very well

I've tried a number of commands and attributes, and from different locations:

... manual\source> asciidoctor -n index.adoc -o ../output.html
from within the source folder, grab index.adoc, and output one folder up into output.html
... manual> asciidoctor -n ./source/index.adoc -o output.html
from the manual folder, go down one and grab index.adoc, and output into output.html

Additionally, this is a separate but maybe related query, but I'm still unsure how, if the included files as well as the root file have attributes set, how the processor deals with this.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Output-to-another-folder-with-image-and-css-links-tp6593.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux