Skip to content

Include files filter updates #173

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
May 13, 2021
Merged

Conversation

lmunch
Copy link
Contributor

@lmunch lmunch commented Apr 24, 2021

This patchset keeps the paths to images relative and also improves the usage in combination with the include-code-files.lua filter

lmunch added 2 commits April 24, 2021 09:54
Use the recursive nature of the filter to build up
the correct relative path to images
This improves the usage of include-files.lua filter in combination
with the include-code-files.lua
@lmunch
Copy link
Contributor Author

lmunch commented May 7, 2021

@tarleb Please review

@tarleb
Copy link
Member

tarleb commented May 10, 2021

Thanks, looks good! Can we add a test for this?

@lmunch
Copy link
Contributor Author

lmunch commented May 10, 2021

Sure, I can add a test. I will look at it later this week.

@lmunch
Copy link
Contributor Author

lmunch commented May 13, 2021

@tarleb I have updated the test and documentation, but the CI fails in math2svg which seems to be unreleated.

BTW, awesome work with pandoc, pandoc/latex docker image etc. Use it everyday, highly appreciated.

@tarleb
Copy link
Member

tarleb commented May 13, 2021

Awesome, thanks! I'll look into the math2svg problems.

@tarleb
Copy link
Member

tarleb commented May 13, 2021

It seems that the math2svg problems are caused by changes in the npm ecosystem. It's probably enough to configure a Ubuntu PPA to get a newer node version installed in our testing container. I'll try if that fixes it, and just merge regardless if it doesn't.

@gabyx
Copy link

gabyx commented May 24, 2021

@lmunch : The relative path changes is generally a good idea, but its really bit too intrusive because

  • generally one never uses absolute paths in markdown documents, so one cannot have include paths relative to the working directory anymore which is sad (since images might be inside files/img.png which is relative to the current working dir.

This feature needs probably more thoughts:

A variant with absolute paths like:

```{.include}
${env:ROOT_DIR}/chapters/A.md
```
![](${env:ROOT_DIR}/files/img.png)

will work if ${env:ROOT_DIR} is replaced beforehand with the environment variable ROOT_DIR which points to the root of the document tree.

In this way one can still write multimarkdown documents.

Or maybe (`-M "includes-relative-to-cwd=true")

```{.include .relative-to-current}
subdir/A.md
```
![](files/imgA.png){.relative-to-current}
![](files/imgGeneral.png)

@gabyx
Copy link

gabyx commented May 24, 2021

I added this feature in #177.
See the Readme under transclusion.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants