Create Script / Action for Markdown Equivalent of HTML5's <details>

Not sure if this belongs in Scripting or Actions, but here’s what I’m wondering about:

HTML5 has had a <details> tag for some time.

You’ve probably seen it on a website where the author may want to hide/obfuscate some information that isn’t pertinent to every visitor:

Details "Heading"

This is a paragraph in the details section.


I know none of the current Markdown flavors support some kind of shorthand for this, but do any of you smart people out there think it would be double to add a function as a shorthand for the <details> section?

And when I want to add a shortcut for <details>, I can insert the following:

<>

… which could auto expand to injecting all the <details> stuff

<details>
    <summary>_Cursor goes here_</summary>

_Or here_

</details>

It seems like a weird suggestion/request, but I have a super long Drafts document with a bunch of Todos that have already been completed, and it would be nice to not have to scroll past all of that stuff when looking for the still-to-be-completed items :sweat_smile:

What would be the output you are looking for? An HTML Preview of the document with some collapsed sections? That could certainly be done by replacing markers with the appropriate HTML tags, but that’s not interactive, so I’m not sure how it helps other than giving you a way to visualize your incomplete tasks more easily.

Have you considered other approaches, like moving completed tasks to the end of the list?

There is also an example syntax that adds incomplete tasks to the document navigation menu that might be useful.

I’m not familiar with the <details> element but - as it’s HTML5 - can I assume it should just work in Drafts?

(I’m not familiar enough with the Markdown rendering engine or WebView? to know. (I should probably experiment with HTML 5 Canvas inline also.) I expect the Markdown engine would just pass the element through.)

Oh for sure it would just pass it through. I guess I was hoping maybe someone else had wanted this, and could add it as an Action in Drafts that kind of added some new context to a flavor of Markdown.

1 Like