Skip to content
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

Does this work for relative path? #195

Closed
yc1838 opened this issue Oct 18, 2022 · 1 comment
Closed

Does this work for relative path? #195

yc1838 opened this issue Oct 18, 2022 · 1 comment

Comments

@yc1838
Copy link

yc1838 commented Oct 18, 2022

When rendering a Readme.md file that contains a relative path to an image, will this rendering tool help to retrieve that image and put it back inside the current html item? I am developing an app that can be used to browse repos we get from Github, but I realize somehow only images with absolute paths work for the currently package I used.

@gjtorikian
Copy link
Owner

Well, if the README.md has a path like this:

This is a link to an image in a folder: ![alt text of image](images/foo.png)

Then this tool will turn that to:

This is a link to an image in a folder: <img src="images/foo.png" alt="alt text of image" />

as per the Commonmark spec, no more and no less.

So depending on the file, as long as it's placed relative to that image, it'll be there.

If you need to manipulate the HTML during or after the fact of parsing, you can use https://github.com/gjtorikian/html-pipeline to turn the image into a Base64 or whatever.

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

No branches or pull requests

2 participants