Disabling the visual editor to avoid losing markdown whitespace
-
Firstly, I’ve searched the forums and found multiple posts around this – but all are either old, or seem to ignore the poster saying that the advertised option doesn’t exist any more. (Example)
I use Markdown on my blog, and occasionally want to edit posts within WP. My posts contain code, which is whitespace-sensitive. If I hit the “Edit” button/link within WP, it takes me straight to the visual editor – which removes leading whitespace.
I’d love the option of either completely disabling the visual editor, or at least making the text editor the default.
I’ve tried looking for the checkbox which is mentioned all over the web, and it doesn’t exist within wordpress.com. I’ve looked in:
- Users -> All Users
- Users -> My Profile
- Users -> Personal Settings
- Settings -> General
- Settings -> Writing
Nothing. If there isn’t a way of disabling the visual editor, is there at least some way of preventing it from mangling my posts?
The blog I need help with is: (visible only to logged in users)
-
Hi there. I cannot find any current support document referring to disabling the visual editor, nor can I find anything on making the text editor the default.
It used to be that if you save a post while in the text editor, the next time you clicked on edit it would still be in the text editor, but I just tested it and it no longer seems to work that way. In fact, I tried saving a post in the text editor and when the screen refreshed it was back in visual mode, so I didn’t even leave the editor. This could be related to the changes in the editor and could be either intentional or an as-yet undiscovered bug.
I’ll tag this for staff to follow up as they should be able to tell us which is the case. Please subscribe to the thread so you are notified when they respond and be patient while waiting.
-
Thanks for the confirmation that I’m not missing anything. I hadn’t actually spotted the “change back when saving” issue – but fortunately it seems to save before clobbering the whitespace, so that part isn’t an issue.
I’m slightly surprised that more fuss hasn’t been made about this already – it makes using Markdown for code much harder than it should be. Fingers crossed it’ll be fixed – thanks for the tag assistance.
-
I think the vast majority of users don’t use Markdown or the text editor that much, which is probably why there isn’t much of a fuss. We’ll see what staff says.
-
There are some issues with editor preference with the editor consistently reverting back to Visual regardless of what is saved. However, that issue only appears to be with a few select browsers (Chrome mainly). Could you try another browser and see if you experience the same thing?
@jonskeet – I believe the best solution here is to use the Text Editor, not the Visual Editor. As there isn’t a way to disable the Visual Editor, you will need to click over manually. I”ll update this thread as soon as a fix is in place for the preferred editor.
-
I’m not sure you’ve understood the big problem here. I absolutely know how to switch from the visual editor to the text editor – but by that point it’s lost all my whitespace, which in markdown is significant. Until this is fixed, it basically means that I need to store my posts with the significant whitespace elsewhere, so that I can copy and paste it into the text editor every time I edit. If I just use wordpress.com, then I have no way of editing the post without losing the whitespace – by the time I get into the text editor, the whitespace has gone.
I’ve just tried with IE11 (I normally use Chrome) and I get the same problem there. It’s not clear what’s meant to save the editor preference though – is that meant to be something manual, or is it just meant to remember the last editor I used? (I haven’t found an explicit preference for the text editor anywhere.)
-
Hey Jon,
I’m sorry if I misunderstood your original question! Please see below:
If I just use wordpress.com, then I have no way of editing the post without losing the whitespace – by the time I get into the text editor, the whitespace has gone.
I have a few additional questions for you here:
- Are you pasting into the Visual Editor or the Text Editor?
- What program are you compiling the Markdown text in?
- What Markdown syntax are you using to denote the code blocks? I’m assuming you’re using the traditional backticks, but I just want to clarify.
I’m asking because when I create a post in Markdown in iA Writer using their syntax for code (tabbing), the whitespace is maintained when I transfer to WordPress.com.
It’s not clear what’s meant to save the editor preference though – is that meant to be something manual, or is it just meant to remember the last editor I used?
Basically, if you save a draft in the Text Editor, the next time you open up the Editor to either create a new post or edit an old one, it should default back to the Text Editor as that is set as your “preferred editor”. This way, you ideally don’t have to constantly switch back and forth if you primarily stick to one.
However, the cookie settings for the Editor aren’t being set right at the moment so this isn’t work correctly. For example, on my side, Chrome consistently reverts back to the Text Editor regardless of what Editor I’m in when I save the post. It’s an issue we’re looking into at the moment!
-
1. I originally posted using stackedit.io, which has built-in WP support. When I copy and paste, that’s in the text editor. I’ve never copied Markdown into the visual editor.
2. I don’t “compile” the Markdown text at all. I’ve used stackedit.io for authoring so far, but I’m just as happy writing it directly into a plaintext editor.
3. I’m using the “fenced” style for code blocks: triple backticks followed by the language name, line break, then the code, then triple backticks again.
If the preference is stored in a cookie, is it possible to edit the cookie manually to force the preference? Or is it encrypted or otherwise obscured?
-
However, that issue only appears to be with a few select browsers (Chrome mainly)
I have the same issue in FireFox 31 on Windows 7. Just haven’t noticed it until now as I usually only save while in the visual editor.
-
Hey Jon,
Thanks for the additional information. This seems like a weird combination of issues. For one, I’m experiencing the same loss of whitespace as soon as I switch from the Text Editor to the Visual Editor. However, if I copy the HTML directly from StackEdit, the whitespace stays put, but you have to edit the HTML to have the code appear as code versus preformatted text. So, like you said, switching to the Visual Editor is removing the whitespace. That combined with the current issue with the editor preference creates a less-than-optimal situation.
I tried using another service just to see if it behaves the same way. I pasted some markdown code in Draftin and published it to my WordPress.com blog through their service. It published the HTML version as well, which was preformatted instead of code blocks. I’m looking into a solution on how we could improve this. I’ll let you know as soon as I find out more or have a more solid answer.
As for the editor preference, I don’t believe there’s a way to manually set the cookie, but I’ll double-check for you and get back with a firm answer.
@kokkieh – thanks for the additional report!
-
Had the same problem in Chrome, switched to Firefox 31, still the same but I managed to navigate to the old editor (from Dashboard), it works as expected in both Firefox and Chrome. Looks like it is an issue with the new editor.
-
Hey everyone,
Just an update – the editor preference was fixed on WordPress.org recently here:
https://core.trac.wordpress.org/ticket/29095
The fix should be merged into WordPress.com within the next day or two. We appreciate your patience on this!
@jonskeet – Still digging into the Markdown issue. This is happening on WordPress.org as well so I believe this might be the expected result. The “fix” would be to use the Text Editor only, which will be much easier once the fix above is merged. I’m still confirming for sure though.
-
Thanks very much. I’m not nearly so bothered by the Visual Editor killing whitespace if it’s avoidable – it’ll be a very minor annoyance once per browser, but I can live with that. Great to hear the progress.
-
Hey Jon,
Just got a final answer on this. The Visual Editor does kill the whitespace (expected occurrence). However, once the issue with the editor cookie is settled (should be soon), hopefully this will no longer be an issue as you can use the Text Editor solely.
- The topic ‘Disabling the visual editor to avoid losing markdown whitespace’ is closed to new replies.