5

A programming language that I use lets me format comments and docstrings using markdown, and then export my code and documentation to PDF.

When I edit the file, though, Emacs doesn't see comments as markdown; just as plain boring text.

I would like to access the full power of markdown-mode when I edit comments, without giving up the nice features of my programming languages' major mode outside of comments. How can I do this?

(A similar problem would include using a Javadoc specific mode map and syntax highlighting inside of Javadoc comments, for example)

Clément
  • 3,924
  • 1
  • 22
  • 37

1 Answers1

5

You can use poporg for this. People mostly use it to edit comments in Org mode, but you can use whatever mode you want by setting poporg-edit-hook.

(remove-hook 'poporg-edit-hook 'org-mode)
(add-hook 'poporg-edit-hook 'markdown-mode)
Kyle Meyer
  • 6,914
  • 26
  • 22