Replies: 2 comments 9 replies
-
I find it quite intractable to explain😅 Let me try again. Markdown is the realm we can control, because we host a Markdown compiler ourselves. Therefore, we can do our best to infer what you want if you write Markdown, even if the corresponding JSX isn't valid OOTB. Therefore, if you write JSX is the realm we can't control, because we don't ship our own JSX runtime. We can do some basic transformation, but we figured that too much transformation would be more surprising than helpful to users familiar with React. When you write I think what led to your confusion is that you have that sense of Markdown -> HTML mapping already burnt into your understanding of Markdown. Get rid of that. Markdown doesn't strictly correlate with HTML—it's just declarative markup. There's no promise that |
Beta Was this translation helpful? Give feedback.
-
Also I want to point out that this change isn't required for |
Beta Was this translation helpful? Give feedback.
-
(I'd be happy to work on this issue if someone can point me in the right direction to get started)
It could be argued this is not a bug, but it is certainly unintuitive behaviour that makes things a little harder to work with.
Consider a folder in
docs
that contains a markdown file and an image (this is a pattern that I think could be pretty comon - each docs page contains its own folder of images, i.e. co-locating images with their associated document, if they are specific to the document, rather than shared across the site):The following markdown snippet will correctly render the image:
As this works. GitHub also correctly renders this in pull requests etc.
I think the user would expect that the following would also work:
This form might be used if you want to control the style/width of an image. The snippet above also renders correctly in a GitHub markdown preview in a code change.
However, instead we have to use this form:
This works - however it is unintuitive that this form has to be used given that the pure markdown version works with relative paths properly. It also means that typical markdown previewing tools (such as GitHub's own markdown renderer) fail to render the images. This just makes the process of working with images that are co-located with documents a bit more painful.
I love the tool - I'm migrating Effective Shell to Docusaurus at the moment - one of the reasons I prefer it to Hugo is that I don't have to use weird platform specific features (like
relref
in Hugo) - I can just use plain old markdown links. But thisimg
behaviour is a little odd. I understand it's a low priority issue with a simple workaround, but feels like the entire tool would be a little more user friendly (especially for complex folder structures like mine) if it was possible to use plain old relative paths inimg
tags.An example of this inconsistency (which also shows how GitHub fails to render the
img
tags properly) is at: https://github.com/dwmkerr/effective-shell/blob/main/effective-shell/docs/01-transitioning-to-the-shell/01-getting-started/index.mdPlease see the sandbox at: https://codesandbox.io/s/serene-butterfly-fz6tk?file=/docs/image-issue/image-issue.md
Steps to reproduce
Please see above, or the code at:
Expected behavior
Image tags would be able to reference images using relative paths without any special treatment.
Actual behavior
Image tags that reference images in relative paths require us to use
require
- this fails to preview in many common markdown renderers - such as GitHub's own renderer, meaning we are more likely to make mistakes when using these paths.Your environment
effective-shell
Reproducible demo
https://github.com/dwmkerr/effective-shell/tree/main/effective-shell
This was referenced in bug #6403 that was closed but I believe it is still worthy of discussion as it affects the usability / learning curve of the framework.
Beta Was this translation helpful? Give feedback.
All reactions