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

table cells and pre not correct convertet. #23

Open
rexxitall opened this issue Aug 9, 2018 · 3 comments
Open

table cells and pre not correct convertet. #23

rexxitall opened this issue Aug 9, 2018 · 3 comments

Comments

@rexxitall
Copy link

Hi,
First: nice work !
I think that this bug is relatet to carriage returns. which seems to be added or are inside the code.
So it may be a idea to ensure which kind of "cr/lf" you has inside your html
a soloution might just to delete all crs first or have a switch to decide which keind of cr you want. Unix or Windows ones. I would like also to see switches to disable the conversation of tags.
a nice place to test your resulting code might be http://demo.showdownjs.com/
I currently shuffle Autocad Help files to your program . (After i shovel it trough htmltidy) - so the html was clean and valid. If you want to have a nice real world testcase download a autocad offline help file. there are nearly 10000 html pages you might test your code with. Testing on selv programmed testcases is not all the time a good idea. You might just have overseen what user can do with it ;)
To be able to convert dl tags would be also nice. i just temporary replace them with table tags at the moment..

Best regards and have a nice day :)

Thomas

@mysticmind
Copy link
Owner

mysticmind commented Aug 10, 2018

Thanks for reporting this. Currently the carriage returns/line feed are determined by OS environment where the code runs. Let me see how best to deal with the carriage returns in source and a configurable way to use appropriate carriage returns in the resultant markdown.

@mysticmind mysticmind added the bug label Aug 10, 2018
@rexxitall
Copy link
Author

rexxitall commented Aug 13, 2018

I think the best way would be a setup switch which CR should be used and have a function to convert the page to this. Maybee you put a switch which CR is awaiting for the table detection. to convert a page is rather trivial - either delete all CR or delete them first al or add them afterwards if they are needed. Both can be done by search and replace. To let the OS decide is not a good idea. Might be that the code was meanwhile edited by a UNIX uder or the Editor environment has set them to something else... You can never be sure what you can await. As a pragmatically guy i would just delete all CRs first and then add them according the user switch. If someone really wants to have CRLF he can be happy and the rest will be happy to get consistent code :) In fact i code this as a workaround. First plame the tags which i want convert byselv with a Xin front, so your code could not see them, then i did my table routine and remove the x from the tags. Shitty but working. For sure you could make me and surely a lot others happy if we do not need such workarounds.

@rexxitall
Copy link
Author

Btw you need to clean the CR LF BEFORE you start parsing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants