Skip to content

Commit

Permalink
ci: quarto automatic render (#9)
Browse files Browse the repository at this point in the history
* ci: quarto automatic render

skip-checks: true

* ci: quarto automatic render

skip-checks: true

---------

Co-authored-by: mcanouil <[email protected]>
  • Loading branch information
github-actions[bot] and mcanouil authored Mar 1, 2024
1 parent 2c5f313 commit b44730e
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 34 deletions.
25 changes: 17 additions & 8 deletions docs/extensions.html

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.6">
<meta name="generator" content="quarto-1.5.22">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down Expand Up @@ -100,7 +100,7 @@
</li>
</ul>
</div> <!-- /navcollapse -->
<div class="quarto-navbar-tools">
<div class="quarto-navbar-tools">
</div>
</div> <!-- /container-fluid -->
</nav>
Expand All @@ -111,7 +111,7 @@
<!-- margin-sidebar -->

<!-- main -->
<div class="quarto-about-trestles content">
<div class="quarto-about-trestles">
<div class="about-entity">
<img src="assets/media/quarto-extension.png" class="about-image
rounded " style="width: 20em;">
Expand Down Expand Up @@ -295,6 +295,11 @@
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// undo the damage that might have been done by quarto-nav.js in the case of
// links that we want to consider external
if (link.dataset.originalHref !== undefined) {
link.href = link.dataset.originalHref;
}
// target, if specified
link.setAttribute("target", "_blank");
if (link.getAttribute("rel") === null) {
Expand Down Expand Up @@ -336,7 +341,11 @@
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
if (note) {
return note.innerHTML;
} else {
return "";
}
});
}
const xrefs = window.document.querySelectorAll('a.quarto-xref');
Expand Down
2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/site_libs/quarto-nav/quarto-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
const links = window.document.querySelectorAll("a");
for (let i = 0; i < links.length; i++) {
if (links[i].href) {
links[i].dataset.originalHref = links[i].href;
links[i].href = links[i].href.replace(/\/index\.html/, "/");
}
}
Expand Down
65 changes: 52 additions & 13 deletions docs/site_libs/quarto-search/quarto-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,18 @@ function showCopyLink(query, options) {
// create the index
var fuseIndex = undefined;
var shownWarning = false;

// fuse index options
const kFuseIndexOptions = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};

async function readSearchData() {
// Initialize the search index on demand
if (fuseIndex === undefined) {
Expand All @@ -685,17 +697,7 @@ async function readSearchData() {
shownWarning = true;
return;
}
// create fuse index
const options = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};
const fuse = new window.Fuse([], options);
const fuse = new window.Fuse([], kFuseIndexOptions);

// fetch the main search.json
const response = await fetch(offsetURL("search.json"));
Expand Down Expand Up @@ -1226,8 +1228,34 @@ function algoliaSearch(query, limit, algoliaOptions) {
});
}

function fuseSearch(query, fuse, fuseOptions) {
return fuse.search(query, fuseOptions).map((result) => {
let subSearchTerm = undefined;
let subSearchFuse = undefined;
const kFuseMaxWait = 125;

async function fuseSearch(query, fuse, fuseOptions) {
let index = fuse;
// Fuse.js using the Bitap algorithm for text matching which runs in
// O(nm) time (no matter the structure of the text). In our case this
// means that long search terms mixed with large index gets very slow
//
// This injects a subIndex that will be used once the terms get long enough
// Usually making this subindex is cheap since there will typically be
// a subset of results matching the existing query
if (subSearchFuse !== undefined && query.startsWith(subSearchTerm)) {
// Use the existing subSearchFuse
index = subSearchFuse;
} else if (subSearchFuse !== undefined) {
// The term changed, discard the existing fuse
subSearchFuse = undefined;
subSearchTerm = undefined;
}

// Search using the active fuse
const then = performance.now();
const resultsRaw = await index.search(query, fuseOptions);
const now = performance.now();

const results = resultsRaw.map((result) => {
const addParam = (url, name, value) => {
const anchorParts = url.split("#");
const baseUrl = anchorParts[0];
Expand All @@ -1244,4 +1272,15 @@ function fuseSearch(query, fuse, fuseOptions) {
crumbs: result.item.crumbs,
};
});

// If we don't have a subfuse and the query is long enough, go ahead
// and create a subfuse to use for subsequent queries
if (now - then > kFuseMaxWait && subSearchFuse === undefined) {
subSearchTerm = query;
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
resultsRaw.forEach((rr) => {
subSearchFuse.add(rr.item);
});
}
return results;
}
4 changes: 2 additions & 2 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://m.canouil.dev/extensions.html</loc>
<lastmod>2024-02-01T12:28:23.998Z</lastmod>
<lastmod>2024-03-01T12:07:50.158Z</lastmod>
</url>
<url>
<loc>https://m.canouil.dev/index.html</loc>
<lastmod>2024-02-01T12:28:24.002Z</lastmod>
<lastmod>2024-03-01T12:07:50.162Z</lastmod>
</url>
</urlset>
2 changes: 1 addition & 1 deletion extensions/yaml/mcanouil--quarto-iconify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: https://github.com/mcanouil/quarto-iconify
author: "[Mickaël Canouil](https://github.com/mcanouil/)"
description: |
Use Iconify icons in HTML-based Quarto documents
Use Iconify icons in HTML-based Quarto documents (over 200,000 open source vector icons)
```sh
quarto add mcanouil/quarto-iconify
Expand Down
2 changes: 1 addition & 1 deletion extensions/yaml/mcanouil--quarto-version-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: https://github.com/mcanouil/quarto-version-badge
author: "[Mickaël Canouil](https://github.com/mcanouil/)"
description: |
Version Badge is an extension for Quarto to provide a shortcode to display software version.
Badge is an extension for Quarto to provide a shortcode to display software version or anything as a badge.
```sh
quarto add mcanouil/quarto-version-badge
Expand Down
2 changes: 1 addition & 1 deletion extensions/yaml/quarto-ext--include-code-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: https://github.com/quarto-ext/include-code-files
author: "[quarto-ext](https://github.com/quarto-ext/)"
description: |
No description available
Quarto extension to include code from source files.
```sh
quarto add quarto-ext/include-code-files
Expand Down
2 changes: 1 addition & 1 deletion extensions/yaml/wjschne--apaquarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
quarto add wjschne/apaquarto
```
type: [formats]
categories: []
categories: ["apa-style"]

0 comments on commit b44730e

Please sign in to comment.