giflw / remark-java

Remark is a HTML to Markdown library forked from https://bitbucket.org/OverZealous/remark (mercurial repository)
Other
26 stars 32 forks source link

Strike-through support #1

Closed BoykoAlex closed 7 years ago

BoykoAlex commented 7 years ago

Support for strike through HTML: <span style="text-decoration: line-through;"> There is HTML <del> element, but adding support for it is problematic because JSoup has it as block element instead of inline

HTML: <p>Contains <del>strike through</del> text</p> Becomes markdown: Contains~~strike through~~text (no spaces, because del is block tag)

giflw commented 7 years ago

According to W3C specs (https://www.w3.org/TR/html5/edits.html#edits-and-paragraphs) del can contain paragraphs. Maybe that explain why jsoup sets it as block. I'll try to look that later. Thanks for PR.

giflw commented 7 years ago

Hi @BoykoAlex

I've looking on your first commit in this PR. It was almost ok, I made a few adjusts on tests and in the inline style rules to add a space if del is the block inlined. Please take a look on the commit 44c97a0 (branch BoykoAlex-strike-through) to check if its working as you expect. If its OK, just tel me and I'll pack a new version.

Thanks

BoykoAlex commented 7 years ago

I have tried BoykoAlex-strike-through branch think it's missing a few changes from that first commit of mine. I'm trying to have the following test to work: HTML: <p>Contains <del>strike through</del> text</p> Becomes markdown: Contains ~~strike through~~ text

It's working perfectly if those missing changes are in with your changes for the white space. Missing changes are simple:

giflw commented 7 years ago

I think it's done. Just give-me an OK and I publish it in JCenter.

BoykoAlex commented 7 years ago

@giflw looks good!-) Thanks very much!-)

giflw commented 7 years ago

Closed by #2

giflw commented 7 years ago

Published at:

<dependency>
    <groupId>com.overzealous</groupId>
    <artifactId>remark</artifactId>
    <version>1.1.0</version>
</dependency>