description
site logo
Skip to main content
Emacs
Illustration of upvote icon after it is clicked
How can I color horizontal lines in org mode?
Asked 3 years, 10 months ago
Modified 3 years, 9 months ago
Viewed 1k times
0
Both markdown mode and Org mode allow you to insert a number of dashes on an otherwise empty line (at least three in markdown mode, at least five in Org mode), that are rendered as horizontal rules in the exported output.
In markdown mode, the dashes become green in the markdown buffer.
Would it be possible to obtain the same behavior in an org-mode buffer, where the dashes become colorful?
https://orgmode.org/manual/Horizontal-Rules.html
12.9 Horizontal Rules: A line consisting of only dashes, and at least 5 of them, is exported as a horizontal line.
org-mode
Share
Improve this question
Follow
edited Sep 28, 2021 at 2:36
Drew's user avatar
Drew
80.3k1010 gold badges123123 silver badges261261 bronze badges
asked Sep 27, 2021 at 18:11
alper's user avatar
alper
1,53011 gold badge1414 silver badges4545 bronze badges
It is possible, but you'd have to bring the subject to the org-mode mailing list. From my cursory look, org doesn't define any customizable face for these dashes. -
aadcg
Commented Sep 27, 2021 at 18:25
1
Are you talking about appearance in the Org mode file buffer? If so, are you talking about displaying the five dashes in green? Or do you really want to display a green horizontal rule that runs across the page? BTW, if what you want is to change how the buffer looks, the link reference is irrelevant since it's about export, so it ends up confusing the issue. -
NickD
Commented Sep 27, 2021 at 18:48
Sorry for not clearifying it, I want its apperance in the Org mode file buffer, while I am editing into it. -
alper
Commented Sep 27, 2021 at 19:00
I edited but if the edit is wrong, feel free to revert the edit (or edit some more). -
NickD
Commented Sep 27, 2021 at 21:44
BTW, I just tried and in my case, nothing happens to the dashes in markdown mode. Have you tried with emacs -Q? -
NickD
Commented Sep 27, 2021 at 21:49
Show 6 more comments
1 Answer
Sorted by:
1
Please see the Professor John Kitchin`s original solution from: https://list.orgmode.org/87h7e5dtbb.fsf@ucl.ac.uk/T/#t
you can add a rule like this in an org-mode hook:
(add-hook 'org-mode-hook
(lambda ()
(font-lock-add-keywords
nil
'(("^-\\{5,\\}" 0 '(:foreground "green" :weight bold))))))
that will make a line starting with at least 5 - be green and bold in color.
Share
Improve this answer
Follow
edited Sep 29, 2021 at 13:23
NickD's user avatar
NickD
35.2k33 gold badges3232 silver badges4949 bronze badges
answered Sep 29, 2021 at 12:29
alper's user avatar
alper
1,53011 gold badge1414 silver badges4545 bronze badges
is there any way to preview the horizontal rule within emacs? -
Gangula
Commented Jul 6, 2024 at 14:23
I am not sure :( Maybe you can ask this as a new question? -
alper
Commented Jul 7, 2024 at 16:24
Add a comment
Your Answer
Sign up or log in
Post as a guest
Name
Email
Required, but never shown
By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
org-mode
See similar questions with these tags.
The Overflow Blog
"AI has been the wild west": Creating standards for agents with Sean Falconer
Building better platforms with continuous discovery
Featured on Meta
Will you help build our new visual identity?
Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
Related
8
Sorting an org-mode table with horizontal lines
3
Org-column face settings not coming through in org-mode column view
3
Org-mode: export table columns in verbatim mode
5
Complete path numbering of org-mode headlines and plain lists
2
How can I enable key-binding in a temporary-buffer?
0
need help with very complex find and replace
0
org-mode: getting info about column's header when not visible
0
Preview horizontal rule within org mode
0
Problem about previewing TikZ svg from org-babel (org-mode 9.7) under dvisvgm (TeX Live)
Hot Network Questions
In this video why are the astronauts wearing only their flight suits during dragon training while in others they are in their full starman suits?
How to handle missing weather data (predictors) in production time series forecast with Prophet?
Is it better to nest figure environments inside proof environments, or leave them separate?
Do standing sound waves sound different?
Entity Framework - Is there a safety mechanism to prevent accidentally running Update-Database?
Why "brew search" for "peertube" machtes with "freetube"? How does the search work?
I wonder whether there exists a book of "Formal power series" and "Formal infinite products"?
At Helsinki airport, connecting from Schengen to non-Schengen flight, is there exit immigration?
Axioms of quantum mechanics - intuitive explanation
Is there a smooth function approximating the minimum of a constant and a variable?
When is XLOOKUP() faster than VLOOKUP()?
Can you identify this shell case from Flanders?
Error on numerical integation
Is buying random stocks and then selling off the ones that go down a good way to reduce capital gains tax?
Is there a formal threshold for when a variable is considered 'random' in statistics? What is it?
Why is my gooseberry jam so stiff?
How to make peaks with thick lines pointy?
Why is this endgame winning for Black?
Which workflows more effective: worldbuilding before plotting or the other way around?
TeX development in C instead of Pascal
What does this "lightbulb-ish" symbol mean in figure 1 of the Diffie Hellmann paper?
Does ?????? in psalm 22:1 say god or "my god"
How much time should I take for "self transfer" without checked-in baggage?
Is it rude to make someone an academic reference without getting their permission first?
Question feed
Emacs
Tour
Help
Chat
Contact
Feedback
Company
Stack Overflow
Teams
Advertising
Talent
About
Press
Legal
Privacy Policy
Terms of Service
Cookie Settings
Cookie Policy
Stack Exchange Network
Technology
Culture & recreation
Life & arts
Science
Professional
Business
API
Data
Blog
Facebook
Twitter
LinkedIn
Instagram
Site design / logo (C) 2025 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2025.7.23.31833
human idsss-352priority0id97417f3a-8a43-4ca8-bb94-764bd1e8ccfe