Why do we do/need this?

I write in MojoPad using Org-mode syntax. I need to copy the content to Emacs at some point. So it makes sense to use Org-mode instead of Markdown.

Bold in Org-mode is of the form the content surrounded by one *.

When I write that in MojoPad, the program changes the content like \*Emacs\*.

Why? Can I turn this off? Or How do I turn this off?

macosxguru

It is expanding an Alfred snippet. I type the shortcut and it expends into MojoPad for example.

Thought I should make that clear.

macosxguru

Thanks — and the Alfred detail mattered, so I am glad you added it. It turns out there are two separate things here: the one you hit, and one you have not hit yet but would have.

Why the backslashes appear

You are on a Markdown page, editing in the formatted view. In Markdown, Emacs means emphasis — so when MojoPad saves the page it has to decide whether you meant formatting or the characters themselves. You typed them as text rather than pressing the italic button, so it keeps them as text, and the way to keep an asterisk as an asterisk in a Markdown file is to put a backslash in front of it. Without that, the page would come back next time with the asterisks gone and the word in italics.

It only does this when a character could actually pair — two or more in the same run of text. A single asterisk, or 2 * 3 = 6, is left alone.

So it is protecting your literal characters. For Org that is exactly the wrong way round, because in Org the asterisks are the markup you want to keep.

The quickest fix: edit the source, not the formatted view. View ▸ Formatted / Markdown Source (⌃⌘P) flips the page between the two. In source view you are typing the file itself — MojoPad stores exactly the characters you type and adds nothing. Your Emacs stays Emacs.

The better fix for what you are doing: use plain-text pages. You are not writing Markdown, so there is no reason for the page to be Markdown. A plain-text page stores exactly what you type, always, with no interpretation of any kind.

Convert the page you are on: Format ▸ Convert Page To ▸ Plain Text.
Make it the default for this wiki: open the Info palette, and under Document set New Page Format to plaintext. Every new page is then plain text.
Now the part you have not hit yet

An Alfred snippet arrives on the clipboard, which is a different route from typing — and MojoPad has a setting that treats the clipboard differently: Settings ▸ Editing ▸ Paste Markdown as formatted text, on by default. When something pasted looks like Markdown, MojoPad converts it: headings become headings, bullets become bullets.

For most people that is a convenience. For you it is a trap, because an Org heading looks exactly like a Markdown bullet. A line beginning * Findings is a heading in Org and a list item in Markdown, and nothing in the text says which.

Short snippets are safe — anything under about eighty characters on a single line is left alone, which is why Emacs only ever got the backslash treatment. But expand a longer snippet with a few headings, a quote and some inline code, and MojoPad will decide it is Markdown and convert it. That does not add backslashes; it replaces your Org markup with formatting, so the asterisks are gone rather than escaped. ⌘Z puts it back — if you notice.

Turn that setting off and every paste lands exactly as it left Alfred. Or use plain-text pages, which force every paste to stay plain and skip both problems at once.

And if you keep your Org files on disk

This may suit you better than any of the above: File ▸ New Page from a File… (and following a whole folder) opens a .org file as a plain-text page deliberately. MojoPad refuses to treat Org as Markdown there, precisely because saving it back would rewrite your file into a format it never was. Edit it in MojoPad, edit it in Emacs, either way it stays your Org file, byte for byte — and there is nothing to copy across at all.

One thing to warn you about

If you convert a page that already has the backslashes in it, they come across as-is: the conversion does not go back and take them out, so you will want a quick find-and-replace of * for * on anything already written. New pages will be clean. I have fixed that conversion so it cleans up after itself, but that fix is in the next release rather than the build you have today.

Mark

Thank you Mark.

I am going to use plaintext. That seems to be recommendation to solve all of these problems.

macosxguru

Is it possible to set a preference for all new documents to be plain text?

macosxguru

Info palette ▸ Document ▸ New Page Format → plaintext makes every new page in that wiki plain text.

Mark

Cool. I knew about that. Forgot for some damn senile reason.

macosxguru

1 Like