-
Notifications
You must be signed in to change notification settings - Fork 45
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
Specify the path to generated files for the HTML src attribute. #83
Comments
@bwklein I think what you need to do is somehow remove I think because you're calling |
I just did a little testing on my repo to confirm the above works (barring any breaking setup differences in our file tree structures etc.). I like to use the html backend by calling # adding -r asciidoctor-mathematical will break html backend build!
asciidoctor \
-D docs/output-html and the pdf backend by calling # I prefer vector graphics (svg) over the default png format
asciidoctor-pdf \
-a pdf-themesdir=docs/resources/themes \
-a pdf-theme=mytheme \
-a pdf-fontsdir=docs/resources/fonts \
-r asciidoctor-mathematical \
-a mathematical-format=svg \
-D docs/output-pdf \
docs/master-docs/*/*.adoc So maybe your #!/bin/bash
SOURCE_FILES="path-to-master-docs/*.adoc"
COMMON="
--quiet
--no-header-footer
-a allow-uri-read
--safe-mode=unsafe
-r asciidoctor-bibtex
-r asciidoctor-diagram"
HTML="
-r asciidoctor-html5
-b html5s
$COMMON
-D htm-output-dir
$SOURCE_FILES"
PDF="
-r asciidoctor-pdf
-b pdf
-r asciidoctor-mathematical
-a mathematical-format=svg
$COMMON
-D pdf-output-dir
$SOURCE_FILES"
# HTML build
echo "Building HTML..."
/usr/local/bin/asciidoctor_real $HTML
# PDF build
echo "Building PDFs..."
/usr/local/bin/asciidoctor_real $PDF
echo "Done" Hope this helps! |
Thank you for your help with this matter. The problem is that I want to use images for equations in my site and not require MathJax to run over the page content after page load. It causes some issues with the content on the page jumping around, especially when navigating to an anchor element on a page. With the images the pages load in quickly and the anchor stays in place at the top of the page without any movement. |
Ah I see, that's interesting. Thanks for clarifying. I'm not sure if this is a use case it's designed for to be honest, but I'm sure there's a way to make it work. Without knowing anything about MathJax, can it not output PNGs? Maybe there's just a patch needed in the asciidoctor gem to specify that. |
MathJax can output images. The problem is that it doesn't start replacing equation text with images until after the page is loaded. So the page loads, then lines of text start being replaced by images which expands that part of the document. This happens for every equation and the content moves around in the browser. |
Got it. Maybe |
I'll take a look, thank you. I hope that the output looks the same in PDF and HTML. |
Yeah they use different packages so no guarantee. If asciidoctor-katex leaves image files behind, maybe you could work the other direction and pull those into your PDFs. |
I think the section in the code related to this issue is:
asciidoctor-mathematical/lib/asciidoctor-mathematical/extension.rb
Line 202 in d82041d
Here is some frontmatter I have set up now in a file.
The PDF backend writes images to the correct location and reads images from the same location. No problem there.
The HTML backend is where the problem appears.
If I set
imagesoutdir
to the absolute path of/builds/tecidev/support/static/images
as I do for the PDF backend, which is where I want them to go, then they will write there no problem, but then thesrc
path in the HTML for that image issrc="/builds/tecidev/support/static/images/stem-hash.svg"
instead ofsrc="/images/stem-hash.svg"
which is what I would expect it to be based on myimagesdir
attribute.Currently, in the HTML backend, I set both the
imagesdir
andimagesoutdir
to/images
so that the path is correct in the HTML src attribute, but the images the HTML is pointing to were actually created by the PDF backend process. The HTML process writes them to the 'images' folder in the root of my project that I just .gitignore and delete from time to time. The unwanted byproduct of a broken process. 😢It seems that we need a way to specify where the file should write to as an absolute path like
imagesoutdir
, and also specify the file path for the output files relative to theimagesdir
attribute. Something like the following would be great.You should default the value of
imagesoutpath
to be theimagesdir
attribute if it isn't defined.A more complex example where you wanted the generated images to be in a subdirectory of your main images folder would look like this.
In this case the stem SVG image generated for the HTML processor would go to
/builds/tecidev/support/static/images/gen
and the image src attribute in the output HTML would be/images/gen/stem-hash.svg
.Having said all this, I could totally be missing something and there is a better way to do it all that will solve this issue.
Here is a video tour of the situation.
https://www.youtube.com/watch?v=SVezqj6jCww
I thought this would be better than lots of words here so you can see for yourself how things are setup. The project is in a private repo that I am glad to invite people to if they want to pull the site and test it locally, but I can't make it public at this time.
The text was updated successfully, but these errors were encountered: