Comments (10)
Okay so there are three aspects that you've identified to this issue:
- markdown nav breaks when there are invalid headers – bug; fixed by #220
- missing image due to it being a relative link – do you desire to add support for resolving relative links as a new feature?
- image appearing in h2 due to no newline between it and a separator – however this is how the syntax works and I believe that we shouldn't fix users' faulty markdown
How would you like to approach (2) and (3) @neuromusic?
from napari-hub.
for 2, no... let's not try to add support for this (yet). instead, let's add an entry to the FAQ "Why aren't my images rendering on my plugin description?" and clarify that we only support absolute links.
for 3, that's interesting. Github-flavored markdown must not support the alternate syntax, because it renders as a separator on the Github repo: https://github.com/kevinyamauchi/napari-properties-viewer
I think folks will be surprised if we are rendering markdown differently from Github... if this is because of a GFM difference, should we consider switching to GFM? is this easily supported by our markdown parser? e.g. with marked
its just a single option to switch to the GFM spec
from napari-hub.
It looks like like (2) and (3) are both caused by the fact we don't support relative images. It should be easy to support provided we follow a few heuristics:
- If the image is an absolute URL, then use the URL directly
- Example:
https://example.com/image.png
- Example:
- If the image is a relative URL but does not start with a prefix, then append to repo's raw URL.
- Example:
resources/image.png
->https://raw.githubusercontent.com/<owner>/<repo>/main/resources/image.png
- Example:
- If the image is a relative URL but starts with a
./
prefix, then append to repo's raw URL with./
removed:- Example:
./resources/image.png
->https://raw.githubusercontent.com/<owner>/<repo>/main/resources/image.png
- Example:
- If the image is a relative URL but starts with a
../
prefix, then the description is likely stored in.napari/DESCRIPTION.md
. This means we can remove the../
prefix and add it to the repo's raw URL:- Example:
../resources/image.png
->https://raw.githubusercontent.com/<owner>/<repo>/main/resources/image.png
- Example:
For reference, here are examples of plugins that fall under the above use cases:
- Absolute URL: https://www.napari-hub.org/plugins/napari-segment-blobs-and-things-with-membranes
- Image without prefix: https://www.napari-hub.org/plugins/napari-animation
- Image with
./
prefix: https://www.napari-hub.org/plugins/napari-DeepSpot - Image with
../
prefix: https://www.napari-hub.org/plugins/napari-annotator
There are a couple of edge cases we would need to think about though:
- What if the default branch isn't
main
? We can trymaster
, but even then, users can specify a different branch as the default. - What about versions? We currently don't support showing different versions for plugin on the napari hub, but if we decide to add it in the future, the URLs may change between versions, and there may not be a corresponding version branch / tag for the repo.
Despite these edge cases, I still think it would be a good idea to add the above image resolution logic because in the best case scenario, we'll still be able to show relative images for plugins. However, I wonder if we should instead nudge plugin developers to use absolute image URLs. Maybe it's something we can include in the preview page?
thoughts? @neuromusic @kne42
from napari-hub.
those heuristics sound reasonable
re: the edge cases, when we trigger a fetch to Github, we use the latest URL, but there should also be a permalink for that commit... if we can get that link somehow that would resolve edge cases 1 and 2. I know how to do this through the Github UI, but not the API
from napari-hub.
I wonder if we should instead nudge plugin developers to use absolute image URLs. Maybe it's something we can include in the preview page?
If I recall, we kinda do this... at least in the sense that relative URLs should break in the preview page... but we don't offer any nudge or specific warning
from napari-hub.
there should also be a permalink for that commit... if we can get that link somehow that would resolve edge cases 1 and 2. I know how to do this through the Github UI, but not the API
oooh I like this idea, it looks like we can get permalinks by using the commit directly instead of main
, so something like this:
https://raw.githubusercontent.com/ebouilhol/napari-DeepSpot/ee94c05f78b7294ff193555475b1c050694711fd/image/napari.png
@potating-potato @klai95 any thoughts? we could include the plugin repo's git hash in the plugin data and use that to resolve the images (assuming they're using github)
another option is to overwrite the plugin description markdown at the indexing stage so that every relative image resolves to a permalink
from napari-hub.
another option is we stick with the current behavior and document that relative images are not supported (not sure if we do this already). definitely the easiest to do, but not sure what plugin developers prefer
from napari-hub.
if you're confident that (3) is due to the relative images issue and not a markdown rendering issue, then I'm happy calling this an "enhancement" rather than a "bug" and in the meantime make sure that we document that we only support absolute links.
from napari-hub.
@neuromusic yeah (3) is definitely because it's a relative image haha. I have a POC implemented on the frontend for resolving relative images, and it fixes (3)
I'm happy calling this an "enhancement" rather than a "bug" and in the meantime make sure that we document that we only support absolute links.
that makes sense, marking this as an enhancement
from napari-hub.
closing this issue in favor of #541 since the only remaining task for this issue is adding support for relative images
from napari-hub.
Related Issues (20)
- Deprecation of preview page HOT 1
- Remove frontend components for preview page
- Remove backend components for preview page
- Upgrade terraform to newer stable version
- [staging] Error when clicking on Author's name
- [staging] there is no collections link in menu HOT 1
- Migrate manually created cloudwatch rum resources to terraform
- Removal of `/plugins` impacts npe2 HOT 1
- Publish alarm notification to slack
- maintenance metrics don't show on plugin pages HOT 3
- Sporadic issue with PyPI plugins fetch results in batch of plugins incorrectly marked as stale HOT 4
- Fix frontend alarms HOT 1
- Fix prod e2e tests HOT 1
- <Subscribe> button is not responsive
- <Subscribe> button is not responsive
- Subscribe button is not responsive HOT 7
- Videos don't work in napari-hub pages, but they play in github HOT 2
- Manifest fetching sometimes fails on new plugin release HOT 4
- Napari hub doesn't seem to support manifest files in subdirectories HOT 3
- Plugin author not shown in napari-hub
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from napari-hub.