4 ms·
Does Org have a mechanism for escaping its own syntax? Last time I searched, to type *this* (keeping the asterisks) you had to insert a zero-width space (U+200B
by arboles 9mo ago
Does Org have a mechanism for escaping its own syntax? Last time I searched, to type *this* (keeping the asterisks) you had to insert a zero-width space (U+200B). In markdown you just escape them with \*this\*.
- 1313ed01 9mo agoDid you edit your comment? I was about to begin by saying I could not see how you escaped that, but now I see the backslashes. Looks like even the documentation for org-mode recommends using zero-width spaces: https://orgmode.org/manual/Escape-Character.html https://orgmode.org/manual/Escape-Character.html I think org-mode was never primarily about its rendered output. Most users probably, like me, spend a lot of time (hours every day) in various org-mode documents, staring at what is essentially the raw mark-up. Org-mode in Emacs makes only a few minor changes to how the text is displayed, like hiding link targets, so you rarely look at the output. I export less than 1% of my org documents, so usually I don't care at all about what formatting renders like, as long as I get the mark-up correct enough that org-mode itself is functional (links can be followed, sections collapsed etc). The few documents I do want to export I can imagine using workarounds like the zero-width spaces, but it is not like there is often a need to have things looking like org-mode mark-up in the output. For me at least, worrying about escaping mark-up would be too distracting and just add noise, as the raw mark-up is what I will read anyway. But I think some good way to escape things would not be a bad thing to have. BTW there are verbatim blocks that can be used when you have entire lines of non-org content. And of course src-blocks. But that obviously does not handle every case escapes could be useful.
- arboles 9mo agoThat was some bad luck. I made an edit seconds after the post came rendered to get the formatting right. (On HN I expected to have to type \\\* to render \* but you just have to type \\*) I understand your use case, I just think it makes it not worthy of comparisons to markdown.
- skeledrew 9mo agoWhat's the use case for escaping its syntax? At top level it's just an arbitrarily nested list.
- imiric 9mo agoIn an Org document that contains Org examples (e.g. if this article had been written in Org), even Emacs gets confused about rendering it. So you might find that sections in example text are evaluated as being part of top-level sections and collapsing is wonky, etc. I run into this a lot with gptel. I use a main Org file for all my daily notes, and since gptel streams LLM output as Org (which is good), it conflicts with my main file. I have a post-processing function that converts headings into `#` to avoid this, but it's a hack I'd rather not do.
- arboles 9mo agoKarl Voit writes their articles in Org though, it even says so on the footer.
- skeledrew 9mo agoHmm I'm still not seeing the issue. Why aren't the examples just lists under say an examples header? Or the LLM output? Maybe gptel is expecting output to be in a fresh file or at the top level? It should be a trivial fix to intent a level before inserting.
- arboles 9mo agoSo you can type *word* without it becoming bold? So an article can contain: "The logs come to about ~300 lines once you start the server with ~systemctl start fnord~" The `code` equivalent in Org is ~code~. How do you type that without the Org highlighting removing the ~ from "~300 lines", thinking that the code snippet begins there? This is an example I got from grepping my org files for U+200B.
- org3 9mo agoI wasn't sure how to do this, so I looked into it: If you (setq org-pretty-entities t) below will render correctly in org buffers, and exports correctly too. The logs come to about \tilde{}300 lines once you start the server with ~systemctl start fnord~ Here's a star: \ast
- adityaathalye 9mo agoYeah escaping can be annoying. I've used the following, in addition to the "escape character" method (which is officially documented as the other commenter noted): For in-line escaping, I use tilde-blocks ~ ~ ... as in ~~ . This type-sets in monospace (code format) in exports, which usually* is what one wants anyway, viz. to demarcate the symbol as being symbolised. For non-code text blocks, "Literal Example" https://orgmode.org/manual/Literal-Examples.html https://orgmode.org/manual/Literal-Examples.html This also gets typeset in monospace, in exports. For special symbols, LaTeX-like syntax https://orgmode.org/manual/Special-Symbols.html https://orgmode.org/manual/Special-Symbols.html
- arboles 9mo agoThis summary is definitely useful as I'm myself a user of Org. I still think backslash escaping doesn't get to be annoying, and is a simple algorithm, which is important when you want to paste text into your org documents from other sources. You can keep these tricks in mind while writing, but sometimes it's not you doing the writing. It could be pasted text, it could be a machine writing.