| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Sorry, something went wrong.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e9fe6a9:
|
Sorry, something went wrong.
There was a problem hiding this comment.
Hi @dandrade-meli , thx for ur investigation and input for this !
This change seems trick to match the regex of absolute condition tho.
I think maybe we should have a config such as :absolute to indicate an absolute path, it can get rid of our own isAbsolutePath check. and I could have a patch on it asap.
cc @docsifyjs/reviewers wdyt.
Sorry, something went wrong.
|
Let's identify the behavior we want first without worrying about implementation details. I think we also need to consider if/how Docsify's relativePath configuration option weighs into this discussion. Given the following Docsify site structure: [Root]
└── dir
└── FILE.md
_sidebar.md
index.html
README.md
I believe Docsify's HTML output for /dir/FILE.md image URLs should be as follows:
The table can be a bit confusing but the rules required to match the proposed output are simple:
Thoughts? |
Sorry, something went wrong.
Yea, If the relativepath config is the highest rule, what the users do on paths should follow this config, then things should work well. Unfortunately, users wanna out of the rule and they can manually set one or more specific paths to absolute. Personally, I think it is fine to give users more sugars and tricks if the change would not break a big thing. |
Sorry, something went wrong.
I believe the prefix :absolute idea adds the possibility without breaking the default behavior. |
Sorry, something went wrong.
|
TL;DR:
It could, but...
I believe the goal should be for Docsify to be as intuitive as possible. Docsify's path handling is not intuitive. This is the result of both bugs and questionable design decisions made long ago. These issues aren't obvious or common because they only present themselves is less-common scenarios (which is why they've survived this long), but when they do present themselves it's a mess. Adding configuration options and custom markdown syntax to get out of the mess instead of just fixing the issues that cause the mess is just avoiding the problem and adding more noise, both of which make Docsify less intuitive and less enjoyable for users. FWIW, I have no issues adding configuration options or custom markdown syntax to to make Docsify more capable or enjoyable to use. I'm okay adding an :absolute-like feature so long as long as it makes sense in the big picture (i.e., after we fix the larger issues). |
Sorry, something went wrong.
|
close via #1891. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR documents support for including images with absolute paths and fixes a small bug that made it impossible to use.
This avoids the need to use ../../ to get to the root path.
Enable to fix bugs #850, #415
Example of use:
in /core/render/compiler/image.js which is responsible for generating the html img, there is a check if the href is not absolute.
the isAbsolutePath function uses the following regex to do this check
/(:|(\/{2}))/gwhat this regex does:
if the url contains : or //, then this path is absolute.
but when we used this strategy, adding the : or //, the image was not rendered because in the generated img tag the path kept the : or //
and to fix this bug I applied a simple replace to remove // and : by ``
What kind of change does this PR introduce?
Bugfix
Feature
Docs
For any code change,
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
Related issue, if any:
#850
#415
Tested in the following browsers: