19

Is there any sort of markup in org-mode to get multiple lines of text to be bold, italics, etc?

*This is what I want to be bold and I only want lines to be a certain length so that this doesn't work.* 

I know about using visual-line-mode as an alternative to fill-paragraph which would solve this problem, but I like M-q too much and I want to try and keep my files at a certain width.

Snippets welcome. I don't know Elisp so I can't do it myself. But I guess this would ruin export too.

I'm thinking something like:

#+BEGIN_BOLD All my text in here would be super bold and would be very nice. #+END_BOLD 
4
  • 7
    Duplicate of Inline verbatim and code with quotes in Org-mode, see the fifth point in the answer. Commented Nov 15, 2015 at 13:34
  • So I have to use customize to specify exactly how many lines I want to mark up? That doesn't really seem the same to me. Commented Nov 15, 2015 at 20:26
  • Okay, you can put allowed 1000 lines. It's up to 1000 lines, not only exactly 1000 lines. Commented Nov 15, 2015 at 20:30
  • Seems a bit of a hack, but I guess that works. Thank you. Commented Nov 15, 2015 at 21:13

3 Answers 3

4
(with-eval-after-load 'org ;; Allow multiple line Org emphasis markup. ;; http://emacs.stackexchange.com/a/13828/115 (setcar (nthcdr 4 org-emphasis-regexp-components) 20) ;Up to 20 lines, default is just 1 ;; Below is needed to apply the modified `org-emphasis-regexp-components' ;; settings from above. (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)) 

Source: https://ox-hugo.scripter.co/test/posts/multi-line-bold/

3

As per the answer from nicael's comment on the question:

By default, org-mode allows a single newline. So if you want to be able to add markup to text that spans more than two consecutive lines, you'll need to modify this entry.

(setcar (nthcdr 4 org-emphasis-regexp-components) N) 

... where N is the number of newlines you want to allow.

Higher up in the same answer, it says that you need to add the line:

(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components) 

after the line above.

4
  • 1
    This simply doesn't work for me. I've run exactly what you've posted and restarted org-mode and yet using emphasis over N lines doesn't work. Is there anything I may have missed? Commented Apr 25, 2018 at 21:16
  • @itdoesntwork Sorry, I'm not an expert in emacs, just reposted a good answer here as community wiki since it solved this problem also. Try commenting on the original answer (linked above) and you might be able to get help. Include more information about your setup, such as the emacs version. The one thing I can think of is to create a config file with just this line and then run emacs with this config. Commented Apr 25, 2018 at 21:50
  • Just leaving another comment here in case someone who understands this sees it. This works upon org-reload, but doesn't work upon any editing! Any idea why? Commented Jun 11, 2020 at 20:52
  • @avy The documentation for org-emphasis-regexp-components says "You need to reload Org or to restart Emacs after setting this". Adding the line (org-set-emph-re ... right below (setcar ... worked for me. Commented May 7, 2021 at 9:15
2

org-emphasize in org-mode does this. From https://orgmode.org/worg/doc.html#org-emphasize:

Insert or change an emphasis, i.e. a font like bold or italic. If there is an active region, change that region to a new emphasis. If there is no region, just insert the marker characters and position the cursor between them.

Select the regions and then run org-emphasize with C-c C-x C-f. You will be prompted for the bracketing character to use in the emphasis (* for bold, / for italics, etc.). Entering a space removes existing emphasis.

1
  • 1
    This adds emphasis markers over multiple lines, true, but does not solve the problem of actually displaying or exporting multi-line emphasis. Thanks anyway, up to now I added emphasis markers by hand. :) Commented May 7, 2021 at 8:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.