Background
I'm currently using the CLI for md-to-pdf
. I'm not sure if it's by design or limitation, but when generating PDFs from MD files containing PNG hyperlinks from not within the directory containing the PNGs, the image URL is broken within the PDF.
If I run md-to-pdf
within the directory containing the PNG & MD files, the PDF is generated which correctly embeds the PNG.
Workaround
As a workaround, I would like to change directory to the directory containing the PNG & MD files while the shell script is running (it's part of a pre-commit hook). If I run the shell script at the directory home/user/repo/
, how do I CD to repo/docs/diagrams/<directoryWithPNG&MDs>
? Sorry for the lack of better wording, but I'm new to shell scripting, I like it but it's tedious and I appreciate any help given.
Is it possible for me to return to the directory I was before I switched directories?
Thank you!
cd docs/diagrams/<directoryWithPNG&MDs>
line in the script? Otherwise show what you have done and the results, as it might give us better context. – Doug Smythies Jan 18 '23 at 23:09cd ../../..
, how would I traverse back up torepo/
? is this possible? or must I usecd ../../..
– nlecce Jan 19 '23 at 00:54/home/user/repo
it would just be~/repo
, However, you can also usecd -
which will return to the last directory it was in before you changed to the other directory. – Terrance Jan 19 '23 at 01:05