Monorepo for Tangled tangled.org
854
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview: pages/markdown: perform image transforms even inside ast.HTMLBlock ast.RawHTML #312

open opened by anirudh.fi

Markdown supports embedding raw HTML, and they can be both inline and a separate block. For example:

The <strong>quick</strong> brown fox jumped over the lazy <img src="dog.png" /> This is inline..

<div align="center">
<p>Some text inside HTML here. This is a block.</p>
<img src="foo/bar/baz/x.jpg">
</div>

Our existing markdown transformer traverses the document and when it encounters an ast.Image, we run a transform that swaps the underlying image link to be fetched from the knot (since that's where the actual file lives). This currently only works if the image is markdown, i.e. using the ![alt text](foo.png) syntaxβ€”and not the above described HTML.

goldmark (our markdown parser) exposes inline HTML and HTML blocks as ast.RawHTML and ast.HTMLBlock. We need to add a case for these, and swap out the <img>'s src attribute as we do for markdown images.

[deleted by author]
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:hwevmowznbiukdf6uk5dwrrq/sh.tangled.repo.issue/3lp5csn7ls722