-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for rendering atx headers in the margin #272
Comments
This is great! Thanks for working on this. I once thought something like this would be nice, but I didn't know how to do it or if it was possible. Markdown Mode processes the buffer in two-passes: 1) syntax-propertization, where the overall syntax is parsed and marked with text properties, and 2) fontification, where font lock properties are applied. As such, this code might be better placed in Another thought: since markdown only defines six levels of headings, can we just fix the margin width to 6 (or 7, if we need a space), set the |
Hi! Thanks for the guidance. That does indeed sound like a better place to put the new logic that sets the display properties. I’ll give it a try and see how it goes. The Yeah, 6 or 7 characters sounds like a good default. I’ll put that in. |
Based on your pointers, I was able to implement it. I think what I've got is correct. I hope it fits with your plan. I'll put the details in a pull request and close this issue: |
I'd like to add a new custom variable,
markdown-marginalize-header
, which will cause opening atx-style headers to be rendered into the left margin of the window. Together with a font face on headers, this creates a nice clean visual style where you can see the header levels without the header syntax marks cluttering up the text.You can see it partly working, and partly broken, here:
I would love any help or advice on how to make this work. I've never worked with window margins before, and I don't think I understand the re-parse and re-display cycle, so I'm not sure where the change should go.
The emacs documentation on rendering into the display margins is at https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Margins.html
My work on this is at: https://github.com/algal/markdown-mode/tree/feature/marginal-headers
The text was updated successfully, but these errors were encountered: