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

[WIP] HTML converter #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

[WIP] HTML converter #59

wants to merge 3 commits into from

Conversation

ttlg
Copy link

@ttlg ttlg commented Dec 21, 2018

I implemented Delta <-> HTML encoder/decoder and its tests.
For allowing arbitrary HTML attributes, I added Notus container attribute which containing HTML attributes data. If you do not like the idea, I will remove this part from the pull request.
Please give me any feedback.
Thank you.

@ttlg
Copy link
Author

ttlg commented Dec 21, 2018

supported HTML tags for now are:
blockquote, ul, ol, li, h1, h2, h3, a, b, i, hr, img, br, pre.
Other tags are converted as normal text.

@pulyaevskiy
Copy link
Contributor

Hey @ttlg , thanks for the PR. Just wanted to let you know that I saw it but might not be able to review it right away with all the holidays coming up. I'll try and get to this as soon as possible.

P.S.: After a quick glance, I feel like this is a valuable addition. We need to work out some details (including the Container attribute) but overall it would be nice to get this merged eventually.

@ttlg
Copy link
Author

ttlg commented Dec 23, 2018

Thanks! I look forward your review.

@MagicalTux
Copy link

Looked at this, and embed support is great, however because most people (I guess?) will be extending ZefyrImageDelegate in order for images to be uploaded, it might be nice to support a way to override the image embed tag.

In my case, for example, when an image is inserted I upload & generate an ID for it (server side), so embed.value["source"] is the ID of the image, and delegate's buildImage uses a NetworkImage object with the right url. Making a html export needs to have the correct url of course (the delegate holds a map of id → url info) but also the ID needs to be kept as a data- attribute of the img tag.

I guess it'd make sense to be able to override _writeEmbedTag(), maybe making it override-able.

@MagicalTux
Copy link

@ttlg Thanks for your code, after some testing I noticed your code does not handle linebreaks (no

and htmlKeys.br isn't used by _NotusHTMLEncoder).

Made a quick & very dirty fix for myself by editing _handleBlock, but linebreaks support is definitely needed for conversion to html.

@m9rc1n
Copy link

m9rc1n commented Sep 4, 2019

Hi guys,

How far are we from closing this PR?
I could help you with some functionality here.

@pulyaevskiy
Copy link
Contributor

@ttlg Would you still be interested in addressing comments if I review this pull request?

I think it'd definitely be easier to get this merged if we can remove Container attribute from here and discuss it separately.

@ttlg
Copy link
Author

ttlg commented Oct 1, 2019

@pulyaevskiy sorry for the late reply. I think I do not have enough time to handle the changes.
Looks there are people who are interested in. I want to hand over to them.
like him:
#178

@chocovish
Copy link

There is problem with this. if a line is bulleted (unordered list) and that line contains different styles per word like

<ul>
<li> This <i>is</i> <b>bold</b> </li>
</ul>

it gives output like

  • This
  • is
  • bold

have a llok at this..

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.

5 participants