Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I was surprised to find that there hasn't been a plugin created to show all of the commits from the GitLab Git commit page in DokuWiki, so I went about creating my own. The plugin is very rough and hardcodes a lot of things, but it gets the job done.

This is what the output looks like in DokuWiki:

The DokuWiki markup for it is:

GitLab provides a very handy API to fetching data. It requires a key to fetch the data, which is passed in the request URL and then it returns a JSON string with the response. Then it's a matter of iterating through the results and displaying them in a table.

So here's the plugin code. I've made use of some CSS that's defined by the pagelist plugin. That plugin does provide a way to use it programatically too, but I didn't bother with that since I wanted more control on the size of my output table.
* Plugin: GitLab Commits
* @author Igor Kromin (http://www.igorkromin.net)
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class syntax_plugin_gitlabcommits extends DokuWiki_Syntax_Plugin {
function getInfo() {
return array('author' => 'Igor Kromin',
'email' => '[email protected]',
'date' => '2013-04-21',
'name' => 'GitLab Commits Plugin',
'desc' => 'Shows last commits from GitLab',
'url' => 'http://www.igorkromin.net/');
function getType(){ return 'substition'; }
function getPType(){ return 'block'; }
function getSort(){ return 100; }
function connectTo($mode) {
function handle($match, $state, $pos, &$handler){
return array($match, $state, $pos);
function render($mode, &$renderer, $data) {
if($mode == 'xhtml'){
$pageurl = "*** GITLAB COMMITS URL ***";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $pageurl);
$html = curl_exec($ch);
$json = new JSON();
$array = $json->decode($html);
$renderer->doc .= '<table class="pagelist" style="width:725px"><tr><th class="page">ID</th><th class="page">Author</th><th class="page">Title</th><th class="date">Date</th></tr>';
foreach($array as &$val) {
$renderer->doc .= '<tr><td class="desc">' . $val->short_id . '</td><td class="desc">' . $val->author_name . '</td><td class="desc">' . $val->title . '</td><td class="date">' . $val->created_at . '</td></tr>';
$renderer->doc .= '</table>';
return true;
return false;

Without going into too much detail, this is a very basic syntax plugin. The majority of the code is really just setting up the plugin itself.

The bit that needs to change is the $pageurl, which is the URL to the GitLab commits page, which has to include the key assigned by GitLab.

There is definitely room for improvements here, however this plugin will get a list of commits and will display it in a wiki page. If I get more time, I will try to clean it up, but for now this plugin is 'as is'.


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.