4

Beloved org-mode can be configured so that different headings (aka, entry titles) display with different colors depending on their nesting level, and so that they only show the final markup character instead of the whole string of them.

Is it possible to configure emacs so markdown mode also renders like this?

I notice markdown-mode lets you fold to show only headings, but they are all rendered in the same color, and littered with # characters.

  • I think it is designed to work as you expect out of the box, but the author has made all of the heading levels the same face -- i.e., :inherit markdown-header-face : github.com/defunkt/markdown-mode/blob/master/markdown-mode.el So, consider changing a few faces to different :foreground colors and see if that makes a difference -- markdown-header-face-1; markdown-header-face-2; markdown-header-face-3 – lawlist Aug 14 '15 at 1:36
  • @Drew This is it. There is a customization subgroup that lets you tweak all the faces. Thanks! I'm still not sure how to suppress some of the # marks, but getting the colors right is the big one. – algal Aug 14 '15 at 5:00
  • For the # marks, customize the markdown-header-delimiter-face. – glucas Aug 14 '15 at 19:18
1

Markup hiding is now part of the current development version of Markdown mode. Markup for headings, but also bold, italics, links, code, etc. can be hidden and toggled interactively using C-c C-x C-m (M-x markdown-toggle-markup-hiding). I should note that this is slightly different than what you asked in your question: even the final hash mark is hidden. You can set the default state by customizing markdown-hide-markup.

Indeed, as lawlist mentioned in a comment, to change the colors you can customize the specific heading level faces: markdown-header-face-1 to markdown-header-face-6. These all inherit from markdown-header-face, which is why the default colors are all the same. Themes can certainly customize the colors to be different.

Also, variable height heading faces have been built in for a while now. Set markdown-header-scaling to t to enable that.

0

Colors and other attributes can be manually changed atleast:

Based on this:

  1. Click on a place where there is no text in the whole line.

  2. M-x customize-face

  3. Customize face (default ‘all faces’): Customize face (default ‘all faces’): appears in the buffer. RET

  4. find markdown-header-face-1, markdown-header-face-2, markdown-header-face-3, markdown-header-face-4 ...

  5. Click markdown-header-face-1 --> show all attributes' --> Changeforegroundto what you want and then clickState` and save for future sessions.

  6. Same for other face levels.

I wish someone would post a simple script to modify these say in the init file, so that I can keep this settings forever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.