Reputation: 1288
I want to achieve something like this for a documentation that is written with MarkDown:
The toggle will show this sample code either in Objective-C or Swift. I couldn't find anything in MD's documentation that shows that this is possible. Any suggestions?
Upvotes: 8
Views: 17855
Reputation: 1
I resolved this by using excel
text output:
I found out how this works - add cariage return and it works like a champ.
To test manually, I dropped a term in excel:
Upvotes: -2
Reputation: 447
It is possible with GitHub-flavored markdown in 2021
To make a toggle switch just write this HTML markup in your markdown file(HTML is supported in .md files):
<details>
<summary>Toggle Switch</summary>
Foldable Content[enter image description here][1]
</details>
In the above markup, the content inside <details>
tag would be foldable(can be toggled) and the content inside <summary>
tag would be taken as the content of the toggle button.
Upvotes: 21
Reputation: 137058
This is not possible with regular Markdown or GitHub-flavoured Markdown.
Markdown, generally, outputs HTML. The language itself is deliberately very simple:
Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags ... The idea for Markdown is to make it easy to read, write, and edit prose.
What you want to do needs JavaScript.
You could potentially write some JavaScript that works with your Markdown output, though depending on where you plan to host the HTML you may have trouble with that, too.
Upvotes: 3