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

Render image tags #10

Closed
niloch opened this issue Aug 18, 2021 · 5 comments
Closed

Render image tags #10

niloch opened this issue Aug 18, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@niloch
Copy link

niloch commented Aug 18, 2021

Is there a way for this support rendering images so they appear like datasette-render-images but using the markdown syntax ![Alt Text](path/to/image.jpg)? Right now for me, the table view displays the raw html <img alt="" src="/path/to/image.jpg"> without rendering the image itself.

Or is this a case where I'd be better of downloading all those images locally and using datasette-render-images?

@niloch niloch changed the title Renderimage image tags Render image tags Aug 18, 2021
@simonw simonw added the enhancement New feature or request label Sep 22, 2021
@simonw
Copy link
Owner

simonw commented Sep 22, 2021

I don't see any reason not to support regular markdown images. The reason they don't work now is that Bleach is stripping them out:

html = bleach.linkify(
bleach.clean(
markdown.markdown(
value, output_format="html5", extensions=extensions or []
),
tags=[
"a",
"abbr",
"acronym",
"b",
"blockquote",
"code",
"em",
"i",
"li",
"ol",
"strong",
"ul",
"pre",
"p",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
]
+ (extra_tags or []),
attributes=attributes,
)
)

@simonw
Copy link
Owner

simonw commented Sep 22, 2021

I'm going to add style="max-width: 100%" to the image tags.

@simonw simonw closed this as completed in e8f7468 Sep 22, 2021
simonw added a commit that referenced this issue Sep 22, 2021
@simonw
Copy link
Owner

simonw commented Sep 22, 2021

I'm going to re-release this as 2.0 and withdraw that 1.3 release, since this should be considered a breaking change.

@simonw simonw reopened this Sep 22, 2021
@simonw
Copy link
Owner

simonw commented Sep 22, 2021

I yanked the release on PyPI:

Manage__datasette-render-markdown__releases_·_PyPI

simonw added a commit that referenced this issue Sep 22, 2021
@simonw
Copy link
Owner

simonw commented Sep 22, 2021

Released as 2.0 here: https://pypi.org/project/datasette-render-markdown/2.0/

@simonw simonw closed this as completed Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants