Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Dec 31, 2024
1 parent 3932d48 commit 408f98b
Show file tree
Hide file tree
Showing 50 changed files with 1,012 additions and 565 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bbde638b
967adc5b
565 changes: 353 additions & 212 deletions index.html

Large diffs are not rendered by default.

565 changes: 353 additions & 212 deletions tidy-data-weighted-insights.html

Large diffs are not rendered by default.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Plugin = {
hljs,

/**
* Highlights code blocks withing the given deck.
* Highlights code blocks within the given deck.
*
* Note that this can be called multiple times if
* there are multiple presentations on one page.
Expand Down Expand Up @@ -138,7 +138,7 @@ const Plugin = {

// Scroll highlights into view as we step through them
fragmentBlock.addEventListener( 'visible', Plugin.scrollHighlightedLineIntoView.bind( Plugin, fragmentBlock, scrollState ) );
fragmentBlock.addEventListener( 'hidden', Plugin.scrollHighlightedLineIntoView.bind( Plugin, fragmentBlock.previousSibling, scrollState ) );
fragmentBlock.addEventListener( 'hidden', Plugin.scrollHighlightedLineIntoView.bind( Plugin, fragmentBlock.previousElementSibling, scrollState ) );

} );

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

112 changes: 64 additions & 48 deletions tidy-data-weighted-insights_files/libs/revealjs/plugin/markdown/plugin.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import { marked } from 'marked';

const DEFAULT_SLIDE_SEPARATOR = '\r?\n---\r?\n',
DEFAULT_NOTES_SEPARATOR = 'notes?:',
DEFAULT_VERTICAL_SEPARATOR = null,
DEFAULT_NOTES_SEPARATOR = '^\s*notes?:',
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';

const SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';

const CODE_LINE_NUMBER_REGEX = /\[([\s\d,|-]*)\]/;
// match an optional line number offset and highlight line numbers
// [<line numbers>] or [<offset>: <line numbers>]
const CODE_LINE_NUMBER_REGEX = /\[\s*((\d*):)?\s*([\s\d,|-]*)\]/;

const HTML_ESCAPE_MAP = {
'&': '&amp;',
Expand All @@ -35,22 +38,22 @@ const Plugin = () => {
function getMarkdownFromSlide( section ) {

// look for a <script> or <textarea data-template> wrapper
var template = section.querySelector( '[data-template]' ) || section.querySelector( 'script' );
const template = section.querySelector( '[data-template]' ) || section.querySelector( 'script' );

// strip leading whitespace so it isn't evaluated as code
var text = ( template || section ).textContent;
let text = ( template || section ).textContent;

// restore script end tags
text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );

var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
const leadingWs = text.match( /^\n?(\s*)/ )[1].length,
leadingTabs = text.match( /^\n?(\t*)/ )[1].length;

if( leadingTabs > 0 ) {
text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}(.*)','g'), function(m, p1) { return '\n' + p1 ; } );
}
else if( leadingWs > 1 ) {
text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' );
text = text.replace( new RegExp('\\n? {' + leadingWs + '}(.*)', 'g'), function(m, p1) { return '\n' + p1 ; } );
}

return text;
Expand All @@ -65,11 +68,11 @@ const Plugin = () => {
*/
function getForwardedAttributes( section ) {

var attributes = section.attributes;
var result = [];
const attributes = section.attributes;
const result = [];

for( var i = 0, len = attributes.length; i < len; i++ ) {
var name = attributes[i].name,
for( let i = 0, len = attributes.length; i < len; i++ ) {
const name = attributes[i].name,
value = attributes[i].value;

// disregard attributes that are used for markdown loading/parsing
Expand All @@ -92,10 +95,12 @@ const Plugin = () => {
* values for what's not defined.
*/
function getSlidifyOptions( options ) {
const markdownConfig = deck?.getConfig?.().markdown;

options = options || {};
options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
options.separator = options.separator || markdownConfig?.separator || DEFAULT_SLIDE_SEPARATOR;
options.verticalSeparator = options.verticalSeparator || markdownConfig?.verticalSeparator || DEFAULT_VERTICAL_SEPARATOR;
options.notesSeparator = options.notesSeparator || markdownConfig?.notesSeparator || DEFAULT_NOTES_SEPARATOR;
options.attributes = options.attributes || '';

return options;
Expand All @@ -109,7 +114,7 @@ const Plugin = () => {

options = getSlidifyOptions( options );

var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
const notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );

if( notesMatch.length === 2 ) {
content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
Expand All @@ -131,10 +136,10 @@ const Plugin = () => {

options = getSlidifyOptions( options );

var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
const separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
horizontalSeparatorRegex = new RegExp( options.separator );

var matches,
let matches,
lastIndex = 0,
isHorizontal,
wasHorizontal = true,
Expand All @@ -143,7 +148,7 @@ const Plugin = () => {

// iterate until all blocks between separators are stacked up
while( matches = separatorRegex.exec( markdown ) ) {
var notes = null;
const notes = null;

// determine direction (horizontal by default)
isHorizontal = horizontalSeparatorRegex.test( matches[0] );
Expand Down Expand Up @@ -172,10 +177,10 @@ const Plugin = () => {
// add the remaining slide
( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );

var markdownSections = '';
let markdownSections = '';

// flatten the hierarchical stack, and insert <section data-markdown> tags
for( var i = 0, len = sectionStack.length; i < len; i++ ) {
for( let i = 0, len = sectionStack.length; i < len; i++ ) {
// vertical
if( sectionStack[i] instanceof Array ) {
markdownSections += '<section '+ options.attributes +'>';
Expand Down Expand Up @@ -204,7 +209,7 @@ const Plugin = () => {

return new Promise( function( resolve ) {

var externalPromises = [];
const externalPromises = [];

[].slice.call( scope.querySelectorAll( 'section[data-markdown]:not([data-markdown-parsed])') ).forEach( function( section, i ) {

Expand Down Expand Up @@ -257,13 +262,13 @@ const Plugin = () => {

return new Promise( function( resolve, reject ) {

var xhr = new XMLHttpRequest(),
const xhr = new XMLHttpRequest(),
url = section.getAttribute( 'data-markdown' );

var datacharset = section.getAttribute( 'data-charset' );
const datacharset = section.getAttribute( 'data-charset' );

// see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
if( datacharset != null && datacharset != '' ) {
if( datacharset !== null && datacharset !== '' ) {
xhr.overrideMimeType( 'text/html; charset=' + datacharset );
}

Expand Down Expand Up @@ -308,17 +313,17 @@ const Plugin = () => {
*/
function addAttributeInElement( node, elementTarget, separator ) {

var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' );
var nodeValue = node.nodeValue;
var matches,
const markdownClassesInElementsRegex = new RegExp( separator, 'mg' );
const markdownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"]+?)\"|(data-[^\"= ]+?)(?=[\" ])", 'mg' );
let nodeValue = node.nodeValue;
let matches,
matchesClass;
if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
if( matches = markdownClassesInElementsRegex.exec( nodeValue ) ) {

var classes = matches[1];
nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
const classes = matches[1];
nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( markdownClassesInElementsRegex.lastIndex );
node.nodeValue = nodeValue;
while( matchesClass = mardownClassRegex.exec( classes ) ) {
while( matchesClass = markdownClassRegex.exec( classes ) ) {
if( matchesClass[2] ) {
elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
} else {
Expand All @@ -336,34 +341,34 @@ const Plugin = () => {
*/
function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {

if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
var previousParentElement = element;
for( var i = 0; i < element.childNodes.length; i++ ) {
var childElement = element.childNodes[i];
if ( element !== null && element.childNodes !== undefined && element.childNodes.length > 0 ) {
let previousParentElement = element;
for( let i = 0; i < element.childNodes.length; i++ ) {
const childElement = element.childNodes[i];
if ( i > 0 ) {
var j = i - 1;
let j = i - 1;
while ( j >= 0 ) {
var aPreviousChildElement = element.childNodes[j];
if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
const aPreviousChildElement = element.childNodes[j];
if ( typeof aPreviousChildElement.setAttribute === 'function' && aPreviousChildElement.tagName !== "BR" ) {
previousParentElement = aPreviousChildElement;
break;
}
j = j - 1;
}
}
var parentSection = section;
if( childElement.nodeName == "section" ) {
let parentSection = section;
if( childElement.nodeName === "section" ) {
parentSection = childElement ;
previousParentElement = childElement ;
}
if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
if ( typeof childElement.setAttribute === 'function' || childElement.nodeType === Node.COMMENT_NODE ) {
addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
}
}
}

if ( element.nodeType == Node.COMMENT_NODE ) {
if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
if ( element.nodeType === Node.COMMENT_NODE ) {
if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) === false ) {
addAttributeInElement( element, section, separatorSectionAttributes );
}
}
Expand All @@ -375,14 +380,14 @@ const Plugin = () => {
*/
function convertSlides() {

var sections = deck.getRevealElement().querySelectorAll( '[data-markdown]:not([data-markdown-parsed])');
const sections = deck.getRevealElement().querySelectorAll( '[data-markdown]:not([data-markdown-parsed])');

[].slice.call( sections ).forEach( function( section ) {

section.setAttribute( 'data-markdown-parsed', true )

var notes = section.querySelector( 'aside.notes' );
var markdown = getMarkdownFromSlide( section );
const notes = section.querySelector( 'aside.notes' );
const markdown = getMarkdownFromSlide( section );

section.innerHTML = marked( markdown );
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
Expand Down Expand Up @@ -429,14 +434,23 @@ const Plugin = () => {
renderer.code = ( code, language ) => {

// Off by default
let lineNumberOffset = '';
let lineNumbers = '';

// Users can opt in to show line numbers and highlight
// specific lines.
// ```javascript [] show line numbers
// ```javascript [1,4-8] highlights lines 1 and 4-8
// optional line number offset:
// ```javascript [25: 1,4-8] start line numbering at 25,
// highlights lines 1 (numbered as 25) and 4-8 (numbered as 28-32)
if( CODE_LINE_NUMBER_REGEX.test( language ) ) {
lineNumbers = language.match( CODE_LINE_NUMBER_REGEX )[1].trim();
let lineNumberOffsetMatch = language.match( CODE_LINE_NUMBER_REGEX )[2];
if (lineNumberOffsetMatch){
lineNumberOffset = `data-ln-start-from="${lineNumberOffsetMatch.trim()}"`;
}

lineNumbers = language.match( CODE_LINE_NUMBER_REGEX )[3].trim();
lineNumbers = `data-line-numbers="${lineNumbers}"`;
language = language.replace( CODE_LINE_NUMBER_REGEX, '' ).trim();
}
Expand All @@ -446,7 +460,9 @@ const Plugin = () => {
// highlight.js is able to read it
code = escapeForHTML( code );

return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
// return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;

return `<pre><code ${lineNumbers} ${lineNumberOffset} class="${language}">${code}</code></pre>`;
};
}

Expand Down
Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const MathJax3 = () => {
ready: () => {
MathJax.startup.defaultReady();
MathJax.startup.promise.then(() => {
Reveal.layout();
deck.layout();
});
}
}
Expand Down Expand Up @@ -66,7 +66,7 @@ export const MathJax3 = () => {

loadScript( url, function() {
// Reprocess equations in slides when they turn visible
Reveal.addEventListener( 'slidechanged', function( event ) {
deck.addEventListener( 'slidechanged', function( event ) {
MathJax.typeset();
} );
} );
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 408f98b

Please sign in to comment.