I started to write some documentation for a project of mine and I wanted to embed a change log on certain elements in the documentation. Since my documentation format is mkDocs, all documents are written in markdown.

So here is what I came up with:

**last commits**

<div id='commits' data-path='src/io/trivium/extension/'></div>
<script src='https://code.jquery.com/jquery-2.2.1.min.js'></script>
var path = $('#commits').data('path');
var url = 'https://api.github.com/repos/trivium-io/trivium/commits?path='+path;
        success: function(data){
    var str="<table class='docutils'><thead><tr><th>message</th><th>date</th><th>author</th><th>link</th></tr></thead><tbody>";
    for(var idx=0;idx<data.length && idx<10;idx++){
      var one = data[idx];
      var d = one.commit.author.date.substr(0,10);
      var t = one.commit.author.date.substr(11,10);
          +d+" "+t+"</td><td>"
          +"<a href='"+one.html_url+"'>"+one.sha.substr(0,7)+"</a></td></tr>";

So the script queries the github api for the commit log of a certain resource. With that response, the script build a HTML table with all the relevant content.

In real life this snippet evaluated looks like this: