Add support for headings in details summaries#2917
Conversation
|
This is a good working prototype. I think the only other thing I'd probably do differently is either enforce a space after |
|
I thought about requiring a space but didn't add that because it is not required for heading elsewhere in the syntax. That seemed inconsistent to me. But then I also was thinking there was no other syntax which could conflict. I hadn't thought of github issues. Personally, I am indifferent to the idea and don't see much need for a toggle. |
|
Like I said, for me, the space is preferred, but I could go with a toggle if people wanted access to something consistent. My preference is strong enough that I override the default headers with my own plugin https://facelessuser.github.io/pymdown-extensions/extensions/saneheaders/. I guess I could look for the existence of our own (pydmownx.saneheaders) plugin in the registered plugin list and change the behavior if it is installed. That locks us to default and specifically our header override, which I'm also fine with. I'm not specifically asking you to do any of this, only noting that I'll likely want to make the space behavior accessible, one way or another, before I pull this in. |
|
So obviously Markdown's default has to stay as-is due to many existing documents (despite any preference on our parts). However, for a third-party extension, anything is game. As there should not be any pre-existing documents in which headings without spaces exist in the titles of details blocks, there is no backward compatibility issue. You can do whatever you want. It works as-is for my needs. I always include a space myself, so would be indifferent if you added the requirement without a way to toggle it. |
|
Yep, sounds good. I'll figure out what direction I want to head in and revisit. |
I implemented the heading-only behavior as you requested. It wasn't difficult. I just copied and modified the regex for hash-heading to not check for lines before/after as there is never going to be multiple lines within a detail title.