cgiffard / Downsize

Tag safe text truncation for HTML and XML!
BSD 3-Clause "New" or "Revised" License
41 stars 13 forks source link

system to maintain initial image #13

Closed adam-zethraeus closed 10 years ago

adam-zethraeus commented 10 years ago

What do you think would be a good API to preserve an initial image in the HTML?

downsize("", {words:0, keepInitialImage:true});

adam-zethraeus commented 10 years ago

I'm going to start work on this today or tomorrow since it seems to be a blocker for merging anything new into ghost.

cgiffard commented 10 years ago

Sorry, I've been flat out. I'll have a think about the best way to tackle this tonight — let me know if you get started on it, so we don't end up double-handling. :)

ErisDS commented 10 years ago

Bump :) Would looove for this to be resolved even if it's just a temporary workaround with the condition that I remove it when Ghost no longer needs it :wink:

adam-zethraeus commented 10 years ago

i'll take another look shortly.

adam-zethraeus commented 10 years ago

next on my plate if the cleanup (https://github.com/cgiffard/Downsize/pull/16) goes in! :)

adam-zethraeus commented 10 years ago

It looks like the two cases this would have to deal with are markdown output matching:

<p><img src="..." ...></p> and <p><a href="#"><img src=".."></a></p>

ErisDS commented 10 years ago

It currently works for video as well I believe.

adam-zethraeus commented 10 years ago

oh good point, thanks!

cgiffard commented 10 years ago

I want to extend the parser to support tag types rather than regex it. If we merge this we should have a followup to do it properly. :)

ErisDS commented 10 years ago

I think you can close this issue now. I have a plan to reproduce this feature inside Ghost, so that we can upgrade to a newer version of downsize. I don't think it's really the job of downsize to maintain what was a bug.

Also, by having it internally in Ghost, we can properly manage deprecating it once we have equivalent functionality done in the right way.