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

Image attachments #90

Merged
merged 6 commits into from
Sep 30, 2016
Merged

Image attachments #90

merged 6 commits into from
Sep 30, 2016

Conversation

kevindew
Copy link
Member

This provides supports for a markdown tag of [embed:attachments:image:<content_id>] which allows attachments to be embedded as images.

This is primarily to support the use of attached images in specialist publisher, however this does use the same HTML markup as the previous method to attach images !!x so it brings these similar features closer together.

A problem we encountered was the presence of block HTML elements within the image markup. This can cause Kramdown to (un)helpfully escaping the HTML elements to &lt;div&gt; if image is placed within a block level element. To counter this I've put together a pretty ugly regex based fix.

Also in this PR I've got a couple of dependency updates and minor fixes.

Attachments can be embedded using `[embed:attachment:image:<content-id>]`. This
allows us to support specialist publisher inline image attachments and
hopefully it can evolve to become the format other apps use for inline
attachments.
Image attachments can be embedded inside HTML block level elements to
different degrees of validity eg inside a <p> that's invalid whereas
inside a <td> it's valid.

However the way kramdown handles these scenarios is not desirable in
either instance. It will convert the block level HTML elements into
their HTML entity equivalent - thus an end user would see <div
class="img"> on their screen.

The way I've fixed this isn't pretty, we try output the image in a
single line - which resolves some issues - and then we try convert back
elements we expect to have been converted back to HTML.
Copy link
Contributor

@danielroseman danielroseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't think of a less horrible way to do this, unfortunately.

@danielroseman danielroseman merged commit 06e208b into master Sep 30, 2016
@danielroseman danielroseman deleted the image-attachments branch September 30, 2016 10:09
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

Successfully merging this pull request may close these issues.

2 participants