18

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
nicael
  • 1,598
  • 2
  • 13
  • 20
salotz
  • 1,370
  • 10
  • 21
  • 7
    Duplicate of [Inline verbatim and code with quotes in Org-mode](http://emacs.stackexchange.com/questions/13820/inline-verbatim-and-code-with-quotes-in-org-mode), see the fifth point in the answer. – nicael Nov 15 '15 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. – salotz Nov 15 '15 at 20:26
  • Okay, you can put allowed 1000 lines. It's *up to* 1000 lines, not only exactly 1000 lines. – nicael Nov 15 '15 at 20:30
  • Seems a bit of a hack, but I guess that works. Thank you. – salotz Nov 15 '15 at 21:13

3 Answers3

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/

Amir
  • 141
  • 2
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.

joelostblom
  • 133
  • 6
  • 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? – itdoesntwork Apr 25 '18 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](https://stackoverflow.com/questions/17146844/is-there-a-way-to-specify-custom-init-file-on-emacs-startup). – joelostblom Apr 25 '18 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? – avv Jun 11 '20 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. – mzuther May 07 '21 at 09:15
1

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.

hgb
  • 111
  • 3
  • 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. :) – mzuther May 07 '21 at 08:46