amyreese / markdown-pp

Preprocessor for Markdown files to generate a table of contents and other documentation needs
MIT License
309 stars 68 forks source link

any advices on where to process images path in md # INCLUDE module #45

Open fujohnwang opened 6 years ago

fujohnwang commented 6 years ago

since I can !INCLUDE a md file into a merged one, but the md file to be included may have relative path point to some images, the final merged md may have a wrong image path reference, when compile with pandoc or some markdown processor, the path link will broken.

do u guys have any advice on how to handle such situation?

let's say, index.mdpp INCLUDE chapters/chapter1/section1.md, and section1.md refers to relative images/image1.png, in generated index.md, the image path should be chapters/chapter1/images/image1.png

index.mdpp
index.md (generated)
chapters/
     chapter1/
          images/
               image1.png
          seciton1.md
          section2.md
          ...
     chapter2/
.....
fujohnwang commented 6 years ago

I write a simple bash scripts to shift the image path before markdown-pp.

you guys who is interested can refer to such sample template project: https://github.com/keevol/pandoc_book_starter