Skip to content

Instantly share code, notes, and snippets.

@Giorgiosaud
Forked from Iridium-IO/README.md
Last active February 13, 2020 14:25
Show Gist options
  • Save Giorgiosaud/a35ac6cb97effb3ae9ae1899bc767567 to your computer and use it in GitHub Desktop.
Save Giorgiosaud/a35ac6cb97effb3ae9ae1899bc767567 to your computer and use it in GitHub Desktop.
Collapsible Markdown Code Blocks

Example Collapsible Content

Style 1

Click to see more:
Given the following python code
from pychartjs import BaseChart

class myChart(BaseChart):
    pass
chartJSON = myChart().get()

Write the following HTML
<div class="container">
   <canvas id="myChart"></canvas>
</div>
... and JS
var data = {{ chartJSON | safe }}
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, data);

Style 2

Click to see more:
Given the following python code
from pychartjs import BaseChart

class myChart(BaseChart):
    pass
chartJSON = myChart().get()

Write the following HTML
<div class="container">
   <canvas id="myChart"></canvas>
</div>
... and JS
var data = {{ chartJSON | safe }}
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, data);

Style 3

CLICK ME

yes, even hidden code blocks!

print("hello world!")

Notes

  • All code block starter lines, e.g. ```python must be preceded by a blank space.
  • The closing block ``` tag must be followed by a newline.
  • The difference between Style 1 and Style 2 is a blank ` tag at the start of the table body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment