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

Markdown for images isn't playing well with HTML anymore #667

Closed
dooart opened this issue Oct 31, 2018 · 8 comments
Closed

Markdown for images isn't playing well with HTML anymore #667

dooart opened this issue Oct 31, 2018 · 8 comments

Comments

@dooart
Copy link

dooart commented Oct 31, 2018

If you use the image markdown syntax to render an image and put it near HTML code, Docsify will render it as text. The problem was introduced in version 4.8.0.

For example, this would not render the image:

<div>
![](img.png)
</div>

This would also not render the image:

<br/>
![](img.png)

But this would (empty line between HTML and markdown):

<br/>

![](img.png)
@cheng-kang
Copy link
Contributor

Found out this markedjs/marked#488 (comment).


↓The same on GitHub.

<div>
  ![Docsify logo](https://docsify.js.org/_media/icon.svg)
</div>

<br/>
![Docsify logo](https://docsify.js.org/_media/icon.svg)

<br/>

![Docsify logo](https://docsify.js.org/_media/icon.svg)
![Docsify logo](https://docsify.js.org/_media/icon.svg)

![Docsify logo](https://docsify.js.org/_media/icon.svg)

Docsify logo


I would say let's stay with the mainstream, so it's not a bug. What do you think? @QingWei-Li

@QingWei-Li
Copy link
Member

@cheng-kang you're right.
We should follow the mainstream usage.

@QingWei-Li
Copy link
Member

QingWei-Li commented Oct 31, 2018

But I will add a new custom component feature so that we can use markdown in HTML.

@QingWei-Li
Copy link
Member

I found this can be rendered by adding spaces in html...

https://codesandbox.io/s/z2k36lqlrp

# Quick start

<div style='color: red;'>

- a
- b
- c

</div>

@dooart
Copy link
Author

dooart commented Nov 1, 2018

thank you for the tip, @QingWei-Li!

@chnuessli
Copy link

chnuessli commented Apr 8, 2021

@cheng-kang your proposed way doesn't work for me in docsify

<br/>

![logo](../assets/logo_srz.svg)

@MirrorGarak
Copy link

Hi,
I am brand new to this but finally managed to deploy my site! Yay!
However, my images only show on localhost, not when hosted but github pages, with the exception of the sidebar SVG.

Code looks like this:

<p><img src="/_media/banner_sg_lootopians.png" alt="banner_lootopian" width="750" height="250"></p>

Localhost inspect source:

<p>
  <img src="/_media/banner_sg_lootopians.png" alt="banner_lootopian" width="750" height="250">
</p>

Hosted (doesn't show image)

<p>
  <img src="/_media/banner_sg_lootopians.png" alt="banner_lootopian" width="750" height="250"></p>
    ::before
  </img>
</p>

Any advice? why is the local preview not the same as github pages?
Cheers

@docsifyjs docsifyjs deleted a comment from MirrorGarak Apr 20, 2022
@trusktr
Copy link
Member

trusktr commented Apr 20, 2022

Not sure what's up with your images. I would check what errors you see in console. Maybe where you serve them from the same URLs are not valid

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

6 participants