Skip to content

Instantly share code, notes, and snippets.

@Iridium-IO
Last active January 30, 2024 10:36
Show Gist options
  • Save Iridium-IO/931bd780de7fb2aecc376e7af446c5df to your computer and use it in GitHub Desktop.
Save Iridium-IO/931bd780de7fb2aecc376e7af446c5df 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);

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 <tr></tr> tag at the start of the table body
@jjjjoshuamamawag
Copy link

Thanks!

@eabase
Copy link

eabase commented Nov 9, 2020

Your notes does not show the <tr></tr>. You forgot a closing `.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment