typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

# WYSIWYG problems (and a solution) #1317

Open vassudanagunta opened 6 years ago

vassudanagunta commented 6 years ago

Typora is a WYSIWYG markdown editor. This is what sets it apart from all other Markdown editors. It is also why Typora is so loved. But Typora falls short of its promise in a number of places.

The Problems*

These gaps cause confusion and undermine the very thing that makes Typora so popular. Typora should display a document as closely as possible to how it will be rendered when exported to HTML or PDF. As @abnerlee said in response to #320, Genuine HTML preview?:

It should be improved by improving the "default view". Adding new mode will increase the complexity.

The intent of this proposal is to address all of the above issues in a coherent way, avoiding the inconsistencies that tend to result from piecemeal fixes.


*This is not a complete list, and some of the them have been closed as "folded into" this issue @abnerlee.


Solution: a Display markup under cursor menu toggle

This single toggle is conceptually very simple and user-friendly:

This toggle of course does not affect Source Code mode. It only affects normal, Focus, and Typewriter modes.

As a menu toggle rather than as option in Preferences, users can easily switch between pure WYSIWYG mode and one that reveals markup under the cursor. The Display source for simple block (including headings, etc.) on focus Preferences setting would be eliminated.

How a Display markup under cursor toggle solves many issues

▼ = current behavior

Display source on focus
disabled
(pure WYSIWYG)
Display source on focus
enabled
(items under cursor as below)
emphasis, underline, strikethrough, code, etc Text rendered as styled, with markup hidden ▼ Text rendered as styled, but with markup displayed in gray.
#233 Hard line break rendered with newline, soft line break rendered as space (unless overridden by setting). Hard line break and soft line break are rendered as in Source Code Mode for the entire block.
#285 ▼ Headings rendered as styled, with markup hidden Headings rendered as styled, but with markup displayed in gray.
#1026 same as #233 same as #233
#1313 cursor in link does not change rendering, and typing changes the link text. The URL is displayed and edited by typing ⌘-K on the Mac and the equivalent standard on other platforms. This is standard behavior in most editors on most platforms. ▼ show link markup
#443 problem solved by this proposal problem solved by this proposal
#319 Footnotes rendered and numbered as they would be in output, with markup hidden. Perhaps ⌘-K can be used to edit footnote reference in the same way link URLs are edited for #1313. ▼ show footnote markup, with user selected ID
#522 If an option for #522 is implemented and enabled, soft line breaks are automatically inserted and moved to maintain column width, but rendered same as per #233 above. If an option for #522 is implemented and enabled, soft line breaks are automatically inserted and moved to maintain column width, but rendered same as per #233 above.
#2921 and other non-display HTML non-display HTML such as anchor tags are hidden ▼ non-display HTML such as anchor tags are shown
abnerlee commented 6 years ago

We are less likely to implement the pure WYSIWYG mode. We implement the default hybrid view to save users from the traditional switching between source code and preview mode, it will not be a good idea to introduce a new mode again.

Also, I believe users post issues above hoping us to solve their problems in current hybrid editing view, but not expecting us to solve them by providing another rich editor

vassudanagunta commented 6 years ago

@abnerlee But this isn't really a new mode. It is simply the existing Display source for simple block (including headsings, etc.) on focus switch, but made more consistent when it is disabled and when it is enabled. Please read this again carefully and look at how it addresses the issue (see table) and it will become clear.

I see a lot of haphazard fixes to reported problems, when there can be a single, coherent approach that leverages what is good about Typora, what makes it popular.

vassudanagunta commented 6 years ago

@abnerlee You call it "hybrid view", but it really is a WYSIWYG view with the option to display source on cursor focus. This is what makes Typora great. Embrace it! Go all the way!

abnerlee commented 6 years ago

I see, thanks for collection those issues.

It will be lighter than a new "mode", but I wonder if users want "Text rendered as styled, with markup hidden" in all cases, since our users are already "markdown" users.

I think they still want to solve issues like #233 in current mode.

vassudanagunta commented 6 years ago

@abnerlee Sure, you're welcome. I've spent many many hours on this and other UX proposals for Typora because product design and UX are my forte and interest, and I'd like to see Typora provide a consistent and friendly UX.

but I wonder if users want "Text rendered as styled, with markup hidden" in all cases, since our users are already "markdown" users.

When Display source for simple block (including headsings, etc.) on focus is disabled currently, you already do this for headings. What I'm saying is make this switch (renamed and moved to a menu) consistently apply to all markup.

I think they still want to solve issues like #233 in current mode.

If you provide what #233 asks, you will be rendering soft line breaks (what the issue calls "single line breaks") in the editor the same as you do in the output, in otherwords, WYSIWGY. So why create yet another config setting for this?

As I propose above, a single Display source on focus controls rendering of soft line breaks the same as it does for the other issues: When checked you see it as you do in the source, with the soft line breaks rendered. When not checked you see it as it would appear in the output, WYSIWYG.

example of how Display source on focus works

The example below demonstrates how enabling and disabling Display source on focus addresses both #233 and #1313 .


Source Code Mode:

The following lines have **hard line breaks**:

the earth march◦◦⏎
is so much easier◦◦⏎
because you [travel](http://listverse.com/2009/05/02/10-cases-of-liberal-hypocrisy/) light◦◦⏎
and buy bottled water◦◦⏎
along the way◦◦⏎

The following lines have **soft line breaks**:

The saving of our world from pending doom will⏎
come, not through the complacent adjustment of⏎
the conforming majority, but through the⏎
**creative maladjustment** of a nonconforming⏎
minority.



With Display source on focus disabled, you get a pure WYSIWYG display no matter where the cursor is. Here the cursor is in the link text "travel":


The following lines have hard line breaks:

the earth march is so much easier because you tra|vel light and buy bottled water along the way

The following lines have soft line breaks:

The saving of our world from pending doom will come, not through the complacent adjustment of the conforming majority, but through the creative maladjustment of a nonconforming minority.




With Display source on focus enabled, and cursor in the link text "travel":


The following lines have hard line breaks:

the earth march◦◦⏎ is so much easier◦◦⏎ because you [tra|vel](http://listverse.com/2009/05/02/10-cases-of-liberal-hypocrisy/) light◦◦⏎ and buy bottled water◦◦⏎ along the way◦◦⏎

The following lines have soft line breaks:

The saving of our world from pending doom will come, not through the complacent adjustment of the conforming majority, but through the creative maladjustment of a nonconforming minority.




With Display source on focus enabled, and cursor in the word "maladjustment":


The following lines have hard line breaks:

the earth march is so much easier because you travel light and buy bottled water along the way

The following lines have soft line breaks:

The saving of our world from pending doom will⏎ come, not through the complacent adjustment of⏎ the conforming majority, but through the⏎ **creative maladju|stment** of a nonconforming⏎ minority.


abnerlee commented 6 years ago

I don't think user will do the switch between above two options when writing, instead, they will tweek the editor to behaviors they want, and then keep using it.

The pure WYSIWYG looks no enough merits to me, a typical rich editor which user must modify styles by menubar or shortcut key is not good enough for typical markdown users. If the user prefer a pure WYSIWYG thing, they can use a rich editor. I also don't think #1313 wants this mode, he may only wants to change the link editing style.

Also, for #233, some users may to prefer treat hard line breaks as real line breaks, it depends on how user want to understand line breaks, but not on WYSIWYG mode or not

vr8hub commented 6 years ago

I've been playing with Typora after discovering it today, and I'll second @vassudanagunta's notion about the Display source for simple block (including headings, etc.) on focus switch. I was actually coming here to report a couple of bugs, of which I thought this was one. I'm amazed it's by design, because it violates all kinds of UX conventions — it's inconsistent, it's unexpected, and it violates its own design.

"If the user prefers a pure WYSIWYG thing…" — a user of Typora obviously prefers a WYSIWYG thing, otherwise they wouldn't be using it. :) That's precisely Typora's claim-to-fame. If we want to edit markdown code, we'll switch to source code mode (or a more traditional markdown editor).

"I wonder if users want 'Text rendered as styled, with markup hidden' in all cases…" — again, that's precisely what we want. That's why we're using it. And if we don't want it, we have two choices (per @vassudanagunta's) proposal:

  1. Set the View flag to show the code when in focus, which would work for everything.
  2. Leave the View flag off and just switch to source code mode when we want to see the source code. (I personally would choose option #2, but having #1 is valid as well.)

I can't speak to the rest of the proposal. But for me, putting "Display source when in-focus" on the View menu, and making it apply to everything, is a no-brainer. That's how I expected it to work, and that's how, IMO, it should work. (It should be on the View menu so we can assign a hotkey, which we can't do from Preferences.)

Other than that and the couple of bugs(?) I'm about to open, Typora is a pretty brilliant idea. Kudos to everyone involved!

abnerlee commented 6 years ago

Thanks for joining the discussion.

"If the user prefers a pure WYSIWYG thing…" — a user of Typora obviously prefers a WYSIWYG thing, otherwise they wouldn't be using it. :)

Well, actually I'm not fully agree with this. Of course a Typora user prefer WYSIWYG, but they also prefer Markdown, or they will go with rich editors wth markdown backend. Typora user want the benefits from both of them, more editable, and more intuitive operations for tables, task lists, etc from WYSIWYG. On the other hand, more convenient ways to input texts with levels / emphasis or other semantic meanings from markdown. This leading to a mix of them, but not pure WYSIWYG

  1. Set the View flag to show the code when in focus, which would work for everything.
  2. Leave the View flag off and just switch to source code mode when we want to see the source code. (I personally would choose option #2, but having #1 is valid as well.)

It it not exactly same with @vassudanagunta's proposal, the view flag he want would switch between

About @vr8hub's understanding of the view flag:

I don't want to switch between source code mode and WYSIWYG mode. I prefer to do reading/editing in one hybrid view. So the default hybrid view should not contain any invisible blocks, like unused footnotes in #1366

vr8hub commented 6 years ago

You said you didn't fully agree with it, but then you agreed with it. :) ("Of course a Typora user prefer WYSIWYG…)

No one's debating that we like Markdown. Again, we wouldn't be here if we didn't. But Typora's distinction is that we aren't editing in a source window, with a separate Preview window showing the WYSIWYG (which isn't editable), like almost every other Markdown editor out there.

No, with Typora we get to edit the preview, and see/edit the source when we want/need to. Except that Typora is only mostly WYSIWYG. We want it to be all in, while all the while retaining the flexibility to see the source when wanted/needed.

You said I had a different view than @vassudanagunta, but I don't think so. Here's what he says above:

When not checked, Typora functions in pure WYSIWYG mode. Rendering does not change even when cursor is placed in the text, working like any other rich text editor or word processor. Users can change formatting with keyboard shortcuts, menu commands, or switching to Source Code Mode. When checked, Typora works as it does now, but more consistently.

That's exactly what I said. (My #1 is his second, my #2 is his first).

Again, the whole point is to be, first consistent, and second helpful and mindful of the Markdown origins.

For those that want to be able to see/edit the source in WYSIWYG mode, then they leave the flag checked. When the cursor is on something that is formatted, then you see the source. Exactly like what happens now, e.g., when a link gets focus, except that it's more consistent and works everywhere.

For those that never want the source displayed on focus, they would leave the flag unchecked. They can still see and edit the source, they will just switch to source code mode, which is a keystroke away, to do it.

That is the best of all worlds. Those that like to see the source as they move along can do so, but it will work much more consistently than it does now. Those that only like to see the source when they specifically go into source code mode can do so, and the rest of the time they see WYSIWYG. All WYSIWYG, all the time. Until we go into source code mode. :)

avogab commented 5 years ago

I'm a big fan of typora and I have been experimenting several configurations and customization of css' themes but I have to admit that while ran across Display source for simple block on focus I expected a behaviour similar to what @vassudanagunta has suggested.

I'm unable to give advice about how to correctly implement a new WYSIWYG functionality or if that is appropriate at all for the typora's promise, anyway, in practical term, I think it's stressful that in preview mode while correcting a paragraph or simply moving the cursor hover it the rendering process shows the code for simple syntax as bold, emphasis or mark. That is increasingly detrimental as the paragraph goes longer: the focus change abruptly and the eyes must search the new visual position congruent with the cursor position.

vassudanagunta commented 4 years ago

2921 would also be very cleanly fixed by this. (It was closed with a custom CSS solution)

needlesslygrim commented 3 years ago

I would also find this very useful; this would be a handy feature, especially if it could be triggered with a keybind.

cangyuyao commented 3 years ago

This is exactly my second need after custom snippets. It's too annoying and distracting that texts keep jumping around with all markups shown/hidden when I move the cursor.

Before Typora (or markdown) I mainly used Windows Live Writer, which serves well until HTML5 and CSS3 are widely adopted (the rendering somehow caused source code displaying problems). Most of my work can be done in WYSIWYG and if something is strange, just switch to source code mode to fix it.

bwl21 commented 2 years ago

Using several Markdown editors, I can state that Typora is by far one of the best in town.

BUT: Please keep it as Markdown-Editor and do not force to use something else if I wand to master the markdown source. Please keep in Mind "Its key design goal is readability – that the language be readable as-is"

  1. The source-Mode shall be styles independent from hybrid (WYSIWIG) mode
  2. The Source-Mode shall be monospace font with syntax highlighting but nothing else
  3. The Source mode shall use the entire screen width (as the hybrid mode does)
  4. The source mode should have line numbers
  5. There should be side by side preview for complex stuff like mermaid, formula, tables - which need to be edited in source mode.

p.S. The benefit of Markdown is the focus on writing. So IMHO WYSIWIG (a promise which is rarely fulfilled) and Markdown is a contradiction. Typora does the best to mitigate this contradiction. But as it cannot be fully resolved, the access to the plain source shall always be provided