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

Output markdown instead of HTML #33

Closed
jaredreich opened this issue Jul 13, 2017 · 21 comments
Closed

Output markdown instead of HTML #33

jaredreich opened this issue Jul 13, 2017 · 21 comments
Labels

Comments

@jaredreich
Copy link
Owner

jaredreich commented Jul 13, 2017

UPDATE:
1ca5f79
https://github.com/jaredreich/pell#example-markdown

@purplebonsai
Copy link

I also second this. WIth Markdown, the editor can easily be replaced with a <textarea> if Javascript is disabled. In addition, Markdown is easy to convert to other formats, so it can be converted on the fly to HTML if it's needed in some templates.

@leeoniya
Copy link

leeoniya commented Jul 13, 2017

shameless plug, since this was built for exactly this use: https://github.com/leeoniya/reMarked.js

i did an example bi-directional editing demo using [the now-commerical-only] redactor.js & marked [1]: https://leeoniya.github.io/redactor-js/

[1] https://github.com/chjj/marked

@jaredreich
Copy link
Owner Author

It won't be replaced with a <textarea>, that would render this whole lib useless (contentEditable does nothing to a <textarea>). I'm thinking more of a plugin that parses the output HTML to markdown and returns that instead.

@leeoniya
Copy link

I'm thinking more of a plugin that parses the output HTML to markdown and returns that instead.

reMarked.js does exactly this.

@jaredreich
Copy link
Owner Author

Oh I see, cool stuff, will check it out when I investigate this!

@NxtChg
Copy link

NxtChg commented Jul 13, 2017

i did an example bi-directional editing demo using [the now-commerical-only] redactor.js: https://leeoniya.github.io/redactor-js/

This is cool! Would be nice to have the same 2-way editing with a tiny editor.

I'm thinking more of a plugin that parses the output HTML to markdown and returns that instead.

It's probably better to reverse it - work natively with markdown, which is simpler, and then generate HTML as an additional sort of plugin. It should also be more reliable than reverse-engineering HTML.

@leeoniya
Copy link

leeoniya commented Jul 13, 2017

It should also be more reliable than reverse-engineering HTML.

html -> markdown conversion sheds a significant amount of html/css features. so either you restrict the editor to only markdown-compatible features, silently drop htmlisms, or accept that you'll have a vast amount of html in your markdown output, which defeats the purpose [of clean output].

we've had several discussions on this topic previously:

html5cat/redactor-js#2
slab/quill#74

@purplebonsai
Copy link

@jaredreich I think you don't understand. If JavaScript is not available, this all editor could be replaced by a single <textarea> containing all the Markdown text; the Markdown can then be easily edited by hand, unlike HTML.

@NxtChg
Copy link

NxtChg commented Jul 13, 2017

If JavaScript is not available, this all editor could be replaced by a single <textarea> containing all the Markdown text;

It is highly unlikely that in today's world JS is not available, and also that some app/site will work completely without JS... Trying to support this case for 0.00001% of users doesn't make any sense.

@leeoniya
Copy link

@purplebonsai it would be quite odd for a WYSIWYG editor to fall back to Markdown. if anything, it would fall back to contenteditable.

@purplebonsai
Copy link

if anything, it would fall back to contenteditable

But contenteditable doesn't support formatting, does it?

@crdx
Copy link

crdx commented Jul 14, 2017

If JavaScript is not available

It's 2017. JavaScript is always available. What isn't available is reliable internet connections on mobile devices, so if you want to optimise for something, optimise for that.

@purplebonsai
Copy link

purplebonsai commented Jul 15, 2017

It's 2017. JavaScript is always available.

No it's not.

Not only you've decided to reply with unbearable arrogance and ignorance, but you're also making a fool of yourself showing a complete lack of understanding of how the Web works. There are countless reasons why JavaScript might not be available, for example ad-blockers, or for security reasons, accessibility issues, or you're required by your job requirements to support non-javascript environments (go tell your boss "It's 2017, I don't care what you say"), or browsers that block it by default (or maybe that don't support it), or maybe users just decided that they don't want to use JavaScript. You don't get to decide who uses JavaScript and who doesn't, the users do; grow up and get over this. If your way to work is "I don't care about anybody with JavaScript disabled", then this is a perfectly legitimate choice. But the responsibility for this choice is on you, do not shift it on the users. If a webpage doesn't work without JavaScript it's your fault, not the users' fault. Your insolence when tackling this issue is frankly embarrassing, but clearly a sign of high inexperience or maybe just incompetence.

Besides, you've derailed this conversation out of topic completely. Whether this software should work with or without JavaScript is completely irrelevant for the discussion. If pell works only with JavaScript, so be it! We will all live with this; not a big problem. Neither I or anybody else for that matter, asked for pell to change this. If I want/need to make my website accessible to people who don't have JavaScript, I can either 1) choose another editor that works or 2) make myself a fallback when I can't use pell/javascript. Which brings us back to the original topic, "Output markdown instead of HTML": if the editor were to output Markdown instead of HTML, it would be easier to write a custom fallback because Markdown is significantly easier to deal with than HTML.

@NxtChg
Copy link

NxtChg commented Jul 15, 2017

No it's not.

If it's not available - 99.999% of all sites and apps will not work correctly anyway. Trying to base design decisions on the need to support this case is retarded.

@purplebonsai
Copy link

Discussing anything in here is completely pointless. There's none so deaf as those who will not hear.
I came here to offer some feedback and contribute something; instead I'll go looking for some other editor and contribute to another project.

@leeoniya
Copy link

@purplebonsai if you're hell-bent on supporting users with js disabled, W3C's got your back [1]. just barf a textarea and tell 'em to enter whatever they want. there's no reason to have this edge case scenario live here.

i suspect whatever project you end up contributing to isnt gonna tolerate you calling other contributors idiots.

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript

@crdx
Copy link

crdx commented Jul 15, 2017

Not only you've decided to reply with unbearable arrogance and ignorance

The other thing about it being 2017 is that I can no longer be bothered to argue with people like you.

@jaredreich
Copy link
Owner Author

jaredreich commented Jul 15, 2017

@purplebonsai thank you for contributing your time to posting your thoughts and feedback, but the whole reason this library exists is to be progressive and cut out the bloat that nearly all other editors have due to accounting for edge cases or browser incompatibilities that are either obsolete or heading towards obsolescence. Without that goal, this editor instantly becomes just like all the others. Sorry but I won't be writing or merging anything that accounts for javascript being disabled.

Also, as a general rule in open source (or life, for that matter), you should refrain from blatant insulting and overall negativity. Just because people disagree with you doesn't mean they are inexperienced, arrogant, ignorant, a fool, insolent, etc.

@jmls
Copy link

jmls commented Sep 16, 2017

so having read through all the "comments" , can I get back to the original question ... can pell output markdown ? :)

@jaredreich
Copy link
Owner Author

jaredreich commented Sep 18, 2017

@jmls It cannot, but it does output HTML, which can be quickly and easily converted to markdown and back with another library such as https://github.com/domchristie/turndown

@jaredreich
Copy link
Owner Author

jaredreich commented Mar 17, 2018

I've added an markdown usage example to the README.
1ca5f79
https://github.com/jaredreich/pell#example-markdown

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

No branches or pull requests

6 participants