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

Fix relative image paths #70

Merged
merged 4 commits into from
Jan 3, 2020
Merged

Fix relative image paths #70

merged 4 commits into from
Jan 3, 2020

Conversation

dalemartin
Copy link
Contributor

@dalemartin dalemartin commented Jan 3, 2020

I have a project with a non-flat directory tree, similar to this:

basedir/images/.png
basedir/content/.adoc
basedir/docs/master_doc.adoc

Assume source.adoc defines the following attributes:

:imagesdir: ../../images
:imagesoutdir: {imagesdir}/equations/generated_images

I found that asciidoctor-pdf could not retrieve the asciidoctor-mathematical generated images if :imagesdir: was set, if :imagesoutdir: was not set, or both not set.

This PR allows any combination of :imagesdir: and :imagesoutdir: attributes to work even if they are empty or not in a flat directory tree. The attributes can be relative or absolute paths. If the attributes are left empty, the images are created in the same directory as the AsciiDoc source file, which I believe is the default behaviour for asciidoctor-pdf if :imagesdir: is not set.

@ProgramFan
Copy link
Contributor

Thank you for your contribution.

@dalemartin dalemartin deleted the feature/dm.fix_image_paths branch January 3, 2020 15:57
@bwklein
Copy link

bwklein commented Jul 1, 2020

This didn't fix my issue in #83 but it did move the location of where the HTML processor was writing images to. It was putting them in the images folder of my project directory, now is it putting them in the /images folder at the root of my filesystem.

I still have the same problem where the image src attribute is wrong unless I put the generated images in the wrong location on my filesystem and depend on the PDF extension to put them in the correct spot for me.

@dalemartin
Copy link
Contributor Author

@bwklein I just watched your video from #83, and a lot it is beyond me because I'm not familiar with web stuff. But I think the fundamental problem you're having is that this extension (asciidoctor-mathematical) is not meant to be called by the html5 backend, nor is it needed. The html5 backend handles latex/stem support beautifully by itself using something else, maybe MathJax or similar. You should only call this extension when running the PDF backend. I'll comment more specifically on #83.

@bwklein
Copy link

bwklein commented Jul 14, 2020

I use mathematical for HTML because I want optimized images (PNG) for the equations and do not want the poor page load experience when MathJax does it's thing after page load.

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.

3 participants