Closed Blackglade closed 4 years ago
The big difference is the copy results.
gatsby-remark-copy-linked-files
copies all files directly under public
. This plug-in preserves and copies the original directory hierarchy.
Keeping the directory hierarchy also keeps relative links from Markdown.
Ahh okay, so I was running into an issue with remark-copy-linked-files
where a markdown file referencing a pdf in another folder in another directory wasn't working.
If the PDF was in the same directory or a sub-directory and I referenced it like this in markdown:
[my pdf](./assets/file.pdf)
It would work, but referencing a file in another directory:
[my pdf](../another_dir/assets/file.pdf)
would not work. Will this plugin resolve the issue?
Yes. Relative paths to other directories are OK if they match the structure of the public
directory.
e.g.
Structure of file and directory on src
.
.
├── bar/
│ └── sample.png
└── foo/
└── foo.md
Relative path from foo.md
![Image on another directory](../bar/sample.png)
Structure of file and directory on public
(Copied by gatsby-remark-copy-relative-linked-files
).
.
└── bar/
└── sample.png
The link is valid because the structure is kept even in public
. This plugin only copies relative paths. For example, ignore absolute paths such as https://
, http://
, ...etc.
After answering, I will close it because there is no other question. If have any questions, please use another issue.
Sorry for being blunt, but I'm a little bit confused as to the difference between this plugin and the https://www.gatsbyjs.org/packages/gatsby-remark-copy-linked-files/ plugin?
Isn't really explained well in the documentation