mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-23 13:15:49 +00:00
[FEATURE] syntax highlighting and preps for compatibility w/ pandoc-parsed markdown
This commit is contained in:
@@ -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("<div id='"+linkid+"'><pre>");
|
||||
//also put in a link to this in the tab header ul
|
||||
$('ul', cb_area).append("<li><a href='#"+linkid+"'></a></li>");
|
||||
@@ -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:
|
||||
// <div class='multicode'>
|
||||
// <p><em>tab 1 title</em></p>
|
||||
// <pre><code>tab 1 code block</code></pre>
|
||||
// <p><em>tab 2 title</em></p>
|
||||
// <pre><code>tab 2 code block</code></pre>
|
||||
// </div>
|
||||
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("<ul class='codetabs'></ul>");
|
||||
|
||||
cb_area.children('pre').each(function(index2,el2) {
|
||||
var linkid = 'code-'+index+'-'+index2;
|
||||
$(el2).wrap("<div id='"+linkid+"'>");
|
||||
//also put in a link to this in the tab header ul
|
||||
$('ul', cb_area).append("<li><a href='#"+linkid+"'></a></li>");
|
||||
});
|
||||
|
||||
$(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
|
||||
/*
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
<link href="vendor/flatdoc/v/0.8.0/theme-white/style.css" rel="stylesheet">
|
||||
<script src="vendor/flatdoc/v/0.8.0/theme-white/script.js"></script>
|
||||
|
||||
<!-- syntax highlighting -->
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/docco.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
|
||||
|
||||
|
||||
<!-- Custom Stylesheets -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:600italic,400,700,300" rel="stylesheet" type="text/css">
|
||||
@@ -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();
|
||||
});
|
||||
</script>
|
||||
<!-- end flatdoc load -->
|
||||
<!-- Alternate multicode tabs for compiled page:
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".multicode").minitabs()
|
||||
//$(".multicode").minitabs()
|
||||
$().multicode_tabs();
|
||||
make_code_expandable();
|
||||
|
||||
//syntax highlighting:
|
||||
hljs.initHighlightingOnLoad();
|
||||
});
|
||||
</script>
|
||||
<!--end alt code for compiled page -->
|
||||
@@ -136,6 +148,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
|
||||
|
||||
<!-- BEGIN FLATDOC PRE-GENERATED CONTENT -->
|
||||
|
||||
|
||||
<!-- END FLATDOC PRE-GENERATED CONTENT -->
|
||||
|
||||
</div>
|
||||
@@ -148,6 +161,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- END FLATDOC PRE-GENERATED CONTENT -->
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user