-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
How to add images from root? #850
Comments
This changes the links but not the path to pictures. Am I doing something wrong? |
Hmm, it’s maybe a bug |
I confirm this is a bug. When you use |
Hmm .. |
Yes, now it works (with a workaround) |
Hey @LemarkNova , Thanks for reply. I am confused about the img tag compile result. my markdown content is : ![my img](/myimg.png) The docsify compiled result is : <img src="/foldername/subfoldername/myimg.png" alt.../> my expected result is : <img src="/myimg.png" alt.../> because my all static img file is just in a single folder. |
I found that this 「long path」is not caused by "marked" —— docsify compile markdown file by it, It seems caused docsify ? Something could be config ? |
No finally it isn't fixed, I remember that I just use a workaround to use image in markdown: |
Does Docsify use the latest version of marked? But I just try with marked and it work. |
Thanks for your help. I note the workaround way. I do nothing about the compilation of markdown files, just do some steps from the official documentation. I am not sure the version of marked, but the docsify I installed is the latest version. |
Hi, could you please help me? #936 |
I've the same problem :( |
It's quite difficult to cover all the cases with a single syntax. I will try to look around this soon. |
@anikethsaha the behavior should be in function of relativePath? |
Yes
Need an investigation about this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still an issue. |
hook.beforeEach(function(content) {
return content.replace(new RegExp("/images", 'ig'), "../images");
}) or hook.afterEach(function(html, next) {
let reg = new RegExp(vm.config.basePath + ".*/images", 'ig');
html = html.replace(reg, vm.config.basePath + "images");
next(html);
}) or markdown: {
// https://marked.js.org/#/USING_PRO.md#renderer
renderer: {
image: function(href, title) {
return `<img src="${href}" data-origin="${href}" alt="${title}">`
}
}
} |
In
In
|
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850 (cherry picked from commit 36cacc5)
If your image is in GitHub repo, Use 'img src' instead of markdown and attach "?raw=true" to end of image's URL.
I don't know why, but it works. |
I come up with the same problem, i think the most convinent way is to turn |
…ve method as use same router with markdown file then remove beginning # (docsifyjs#877、docsifyjs#850)
…, solve method as use same router with markdown file then remove beginning "#" (docsifyjs#877、docsifyjs#850)
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850
same issue here! |
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850
Bug acknowledged. Tracking with #1891. |
Using "<img src />" HTML cannot guarantee relative paths. The issue is being investigated but using a markdown table format would be an alternative approach. - FYI: docsifyjs/docsify#850
For example, I have 2 folders in the root directory. There is a picture in the first folder (images).
The second folder (docs) contains the markdown file.
How do I insert an image into this markdown file that is located in the folder (images).
If I put it this way:
![](/images/testimage.jpg)
He tries to add it like this:
/docs/images/testimage.jpg
The text was updated successfully, but these errors were encountered: