-
Notifications
You must be signed in to change notification settings - Fork 16
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
rewrite-path
and include-entry
are not working together properly
#54
Comments
replace relative image paths with absolute ones closes DCsunset#54
replace relative image paths with absolute ones closes DCsunset#54
I sent PR #55 with a minor change. Instead of rewriting the image URL relative to It solves the situation described in this issue, and I also tried with the following structure and that works as well.
And, to be quite honest, I can't be bothered to add proper test cases etc., so sry about that. |
That's a good catch! Your solution makes sense when the output is in a format that could embed the image. However, in some cases, users may want to keep the relative path to make the output file more portable. For example, a user may want to compile a bunch of markdown files into one but keep the relative resource link so they can publish to another place. I think we can rewrite the path to the absolute path by default, but at the same time we should provide an option to allow relative path rewrite as well. @FynnFreyer Could you add an option like |
Oh I just realized that we don't need another option. We can allow
|
That makes sense, but in that case, I'd suggest to just do it with relative paths again. One could compare Unfortunately, I don't have the time to do this properly right now, since I'm in the middle of writing my thesis^[2], so I'll try to get back to this in about three weeks, but no promises that I won't forget. [1]: or something similar, not sure what the exact key was |
Also, the following is pretty off-topic, but maybe I can pick your brain on this. There's often lively discussion on how to do transclusion syntax in markdown,^[1] with a few popular ideas coming from iA Writer^[2], Obsidian^[3] and MultiMarkdown^[4]. Pandoc-include is doing I'm using Obsidian, so personally I'd like to see the image syntax supported. Without having checked this too carefully, it seems like you'd only need to make changes to Do you see any glaring problems with this idea, and if not, would you in theory be open to a PR regarding this? If so, I might open an issue for that and work on it in the future.^[5] [1]: This old discussion on the commonmark forum gives a decent overview, I think. |
It would be great to support other popular syntaxes to make it compatible with more applications. I think your idea should work without problem. We just need to add an However, Instead of hard-coding such functions directly in |
I just implemented the fix in the latest commit which fixes the relative path rewrite. Feel free to test it when you have time. |
Tested with 1195edc, and it works in my project, thanks for the quick action |
Damn, my bad, I didn't update my venv properly so tested with the wrong version. This seems to persist with 1.3.3 unfortunately |
I've added another fix in the master branch. I've tested the case locally and it works fine. Could you verify it on your side as well? |
sure, but I'll have to hand in my thesis on monday, will check after that |
Solved with 4c4c0b7 |
Expected
When generating a PDF from a file in a subdirectory, that has
include-entry
set, and is including a file with an image, that is referenced relative to the included file, the produced PDF includes the image.At least that's expected, if we have
rewrite-path
set to true, which is the default.Actual
The image is not included.
Reproduce
Install pandoc-include into an otherwise empty
venv
in version 1.3.2.Create a directory structure like this:
Contents of
img.md
Path to
img.svg
is relative to the directory this file resides in, which should be okay withrewrite-path: true
.Contents of
test_a.md
The
include-entry
is set relative to the working directory,rewrite-path
is set (already the default, but we make it explicit).Contents of
test_b.md
This file resides in the working directory.
Results
We run
The
test_b.pdf
file contains the picture, whiletest_a.pdf
does not.The text was updated successfully, but these errors were encountered: