Javascript on markdown file

I am new to web programming - HTML Javascript etc. Here I am testing how to use javascript on a markdown file for a github site. The code is as follows,

The code is taken from here

For HTML

<head>
	<!-- Load plotly.js into the DOM -->
	<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>

<body>
	<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>

For Java script

<script>
    var trace1 = {
  x: [1, 2, 3, 4,5],
  y: [1,1,2,2,0],
  mode: 'lines', //use markers if you want just dots
  type: 'scatter'
};

var data = [trace1, trace2, trace3];

Plotly.newPlot('myDiv', data);
</script>

All in in one .md file in the _posts folder with correct naming. Results in the following figure.

Posts

subscribe via RSS