diff --git a/js/multicodetab.js b/js/multicodetab.js index 27d9f86055..b5eea7f698 100644 --- a/js/multicodetab.js +++ b/js/multicodetab.js @@ -16,7 +16,6 @@ jQuery.fn.multicode_tabs = function() { // for each code, give it a unique ID and wrap it in a pre cb_area.children('code').each(function(index2,el2) { var linkid = 'code-'+index+'-'+index2; -// $(el2).attr('id', linkid); $(el2).wrap("
");
             //also put in a link to this in the tab header ul
             $('ul', cb_area).append("
  • "); @@ -32,6 +31,38 @@ jQuery.fn.multicode_tabs = function() { $('.multicode').minitabs(); } + +// Variant version for the HTML that Pandoc generates +// Expects markup in the form of: +//
    +//

    tab 1 title

    +//
    tab 1 code block
    +//

    tab 2 title

    +//
    tab 2 code block
    +//
    +jQuery.fn.multicode_tabs_pandoc = function() { + $('.multicode').each(function(index,el) { + cb_area = $(el); + cb_area.attr('id', "code-"+index); + // make a ul to house the tab headers + cb_area.prepend(""); + + cb_area.children('pre').each(function(index2,el2) { + var linkid = 'code-'+index+'-'+index2; + $(el2).wrap("
    "); + //also put in a link to this in the tab header ul + $('ul', cb_area).append("
  • "); + }); + + $(el).find('em').each(function(index2, el2) { + $('ul li:eq('+index2+') a', cb_area).text($(el2).text()); + }); + }); + $('.multicode p').remove(); + + $('.multicode').minitabs(); +} + // Minitabs adapted from https://code.google.com/p/minitabs/ // Changes made: support multiple tab booklets in one page /* diff --git a/rippled-apis.html b/rippled-apis.html index 7f31a3ba48..7a481ee98c 100644 --- a/rippled-apis.html +++ b/rippled-apis.html @@ -24,6 +24,11 @@ + + + + + @@ -69,14 +74,21 @@ mixpanel.init("132d42885e094171f34467fc54da6fab"); Flatdoc.run({ fetcher: Flatdoc.file('content/websocket_api.md') }); - $(document).on('flatdoc:ready', $().multicode_tabs); + $(document).on('flatdoc:ready', function() { + $().multicode_tabs(); + hljs.initHighlighting(); + }); @@ -136,6 +148,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab"); +
    @@ -148,6 +161,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab"); +