File not found Click here to go back to the home page.
<-
\ No newline at end of file
diff --git a/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/404.md b/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/404.md
new file mode 100644
index 0000000000..f5e54988e8
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/404.md
@@ -0,0 +1 @@
+
{{ content }}
\ No newline at end of file
diff --git a/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/default.md b/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/default.md
new file mode 100644
index 0000000000..2507ae479e
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/_markbind/layouts/default.md
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+ Your Logo
+
+
+
diff --git a/packages/cli/test/functional/test_site_pagefind/_markbind/variables.json b/packages/cli/test/functional/test_site_pagefind/_markbind/variables.json
new file mode 100644
index 0000000000..04d0b977d3
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/_markbind/variables.json
@@ -0,0 +1,3 @@
+{
+ "jsonVariableExample": "Your variables can be defined here as well"
+}
\ No newline at end of file
diff --git a/packages/cli/test/functional/test_site_pagefind/_markbind/variables.md b/packages/cli/test/functional/test_site_pagefind/_markbind/variables.md
new file mode 100644
index 0000000000..4a19d29999
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/_markbind/variables.md
@@ -0,0 +1,4 @@
+
+To inject this HTML segment in your MarkBind files, use {{ example }} where you want to place it.
+More generally, surround the segment's id with double curly braces.
+
\ No newline at end of file
diff --git a/packages/cli/test/functional/test_site_pagefind/contents/topic1.md b/packages/cli/test/functional/test_site_pagefind/contents/topic1.md
new file mode 100644
index 0000000000..3f28f03594
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/contents/topic1.md
@@ -0,0 +1,9 @@
+
+ title: Topic 1
+
+
+
+
+# Topic 1
+
+> This is a placeholder page - more content to be added.
diff --git a/packages/cli/test/functional/test_site_pagefind/contents/topic2.md b/packages/cli/test/functional/test_site_pagefind/contents/topic2.md
new file mode 100644
index 0000000000..f86f7be568
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/contents/topic2.md
@@ -0,0 +1,9 @@
+
+ title: Topic 2
+
+
+
+
+# Topic 2
+
+> This is a placeholder page - more content to be added.
diff --git a/packages/cli/test/functional/test_site_pagefind/contents/topic3a.md b/packages/cli/test/functional/test_site_pagefind/contents/topic3a.md
new file mode 100644
index 0000000000..90194da60a
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/contents/topic3a.md
@@ -0,0 +1,9 @@
+
+ title: Topic 3a
+
+
+
+
+# Topic 3a
+
+> This is a placeholder page - more content to be added.
diff --git a/packages/cli/test/functional/test_site_pagefind/contents/topic3b.md b/packages/cli/test/functional/test_site_pagefind/contents/topic3b.md
new file mode 100644
index 0000000000..db7ba8e857
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/contents/topic3b.md
@@ -0,0 +1,9 @@
+
+ title: Topic 3b
+
+
+
+
+# Topic 3b
+
+> This is a placeholder page - more content to be added.
diff --git a/packages/cli/test/functional/test_site_pagefind/index.md b/packages/cli/test/functional/test_site_pagefind/index.md
new file mode 100755
index 0000000000..09177b769c
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/index.md
@@ -0,0 +1,77 @@
+
+ title: Home Page
+ layout: default.md
+ pageNav: 4
+ pageNavTitle: "Topics"
+
+
+
+
+
+
+
Great! You've just initialized a MarkBind site.
+
Let's get started...
+
+
+
+---
+
+## What just happened?
+
+You have just initialized a _default_ MarkBind site! It is equipped with a set of core features, including site and page navigation. Additionally, we have included some convenient links to our User Guide, to help you get started quickly and easily.
+
+
+
+If you were intending to convert an existing GitHub wiki or a docs folder into MarkBind, use the `--convert` flag instead. See User Guide: MarkBind in the Project Workflow for more information.
+
+If you want to start with a _minimal_ template instead, use the `--template` flag with the "minimal" option to initialize a minimal site instead of the default. See User Guide: Templates for more information.
+
+
+
+---
+
+## Navigating this site
+
+This _default_ site comes pre-configured with the core Navigation components: a **siteNav**, a **pageNav**, a **NavBar**, and a **Search Bar**. To help you get started with the **siteNav**, we have included five dummy placeholder pages. The **NavBar** also comes with a placeholder slot for your custom Logo.
+
+---
+
+## Guide to MarkBind
+
+To see the capability of MarkBind in action, feel free to take a look at some of the websites built using MarkBind on our Showcase page.
+
+For more information on how to work with MarkBind sites and to add content, refer to our comprehensive User Guide.
+
+
+
+If you are interested in contributing to MarkBind, you can refer to our Developer Guide as well!
+
+
+
+
+
+##### **User Guide: Authoring Contents**
+
+> Learn about the variety of syntax schemes, formats, and custom MarkBind components that you can use in your MarkBind site.
+
+More info in: _User Guide → Authoring Contents_
+
+---
+
+##### **User Guide: Working with Sites**
+
+> Learn how to modify site properties, apply themes, and enable/disable plugins for your MarkBind site.
+
+More info in: _User Guide → Working with Sites_
+
+---
+
+##### **User Guide: Full Syntax Reference**
+
+> Refer to our Full Syntax Reference page to find a specific feature or component that you want to use in your MarkBind site.
+
+More info in: _User Guide → Full Syntax Reference_
+
+
+
+---
diff --git a/packages/cli/test/functional/test_site_pagefind/site.json b/packages/cli/test/functional/test_site_pagefind/site.json
new file mode 100755
index 0000000000..eb1d757851
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/site.json
@@ -0,0 +1,28 @@
+{
+ "baseUrl": "",
+ "titlePrefix": "",
+ "titleSuffix": "",
+ "ignore": [
+ "_markbind/layouts/*",
+ "_markbind/logs/*",
+ "_site/*",
+ "site.json",
+ "*.md",
+ "*.njk",
+ ".git/*",
+ ".gitignore",
+ "node_modules/*"
+ ],
+ "pagesExclude": ["node_modules/*"],
+ "pages": [
+ {
+ "src": "index.md"
+ },
+ {
+ "glob": ["**/index.md", "**/*.md"]
+ }
+ ],
+ "deploy": {
+ "message": "Site Update."
+ }
+}
diff --git a/packages/cli/test/functional/test_site_pagefind/stylesheets/main.css b/packages/cli/test/functional/test_site_pagefind/stylesheets/main.css
new file mode 100644
index 0000000000..a380ffd4c2
--- /dev/null
+++ b/packages/cli/test/functional/test_site_pagefind/stylesheets/main.css
@@ -0,0 +1,135 @@
+mark {
+ background-color: #ff0;
+ border-radius: 5px;
+ padding-top: 0;
+ padding-bottom: 0;
+}
+
+.indented {
+ padding-left: 20px;
+}
+
+.theme-card img {
+ width: 100%;
+}
+
+/* Scrollbar */
+
+.slim-scroll::-webkit-scrollbar {
+ width: 5px;
+}
+
+.slim-scroll::-webkit-scrollbar-thumb {
+ background: #808080;
+ border-radius: 20px;
+}
+
+.slim-scroll::-webkit-scrollbar-track {
+ background: transparent;
+ border-radius: 20px;
+}
+
+.slim-scroll-blue::-webkit-scrollbar {
+ width: 5px;
+}
+
+.slim-scroll-blue::-webkit-scrollbar-thumb {
+ background: #00b0ef;
+ border-radius: 20px;
+}
+
+.slim-scroll-blue::-webkit-scrollbar-track {
+ background: transparent;
+ border-radius: 20px;
+}
+
+/* Layout containers */
+
+#flex-body {
+ display: flex;
+ flex: 1;
+ align-items: start;
+}
+
+#content-wrapper {
+ flex: 1;
+ margin: 0 auto;
+ min-width: 0;
+ max-width: 1000px;
+ overflow-x: auto;
+ padding: 0.8rem 20px 0;
+ transition: 0.4s;
+}
+
+#site-nav,
+#page-nav {
+ display: flex;
+ flex-direction: column;
+ position: sticky;
+ top: var(--sticky-header-height);
+ flex: 0 0 auto;
+ max-width: 300px;
+ max-height: calc(100vh - var(--sticky-header-height));
+ width: 300px;
+}
+
+#site-nav {
+ border-right: 1px solid lightgrey;
+ padding-bottom: 20px;
+ z-index: 999;
+}
+
+.site-nav-top {
+ margin: 0.8rem 0;
+ padding: 0 12px 12px;
+}
+
+.nav-component {
+ overflow-y: auto;
+}
+
+#page-nav {
+ border-left: 1px solid lightgrey;
+}
+
+@media screen and (width <= 1299.98px) {
+ #page-nav {
+ display: none;
+ }
+}
+
+/* Bootstrap medium(md) responsive breakpoint */
+@media screen and (width <= 991.98px) {
+ #site-nav {
+ display: none;
+ }
+}
+
+/* Bootstrap small(sm) responsive breakpoint */
+@media (width <= 767.98px) {
+ .indented {
+ padding-left: 10px;
+ }
+
+ #content-wrapper {
+ padding: 0 10px;
+ }
+}
+
+/* Bootstrap extra small(xs) responsive breakpoint */
+@media screen and (width <= 575.98px) {
+ #site-nav {
+ display: none;
+ }
+}
+
+/* Hide site navigation when printing */
+@media print {
+ #site-nav {
+ display: none;
+ }
+
+ #page-nav {
+ display: none;
+ }
+}
diff --git a/packages/core/package.json b/packages/core/package.json
index 29bab65283..e15b65e2e5 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -63,6 +63,7 @@
"material-icons": "^1.9.1",
"moment": "^2.29.4",
"nunjucks": "3.2.4",
+ "pagefind": "^1.0.4",
"path-is-inside": "^1.0.2",
"simple-git": "^3.22.0",
"url-parse": "^1.5.10",
diff --git a/packages/core/src/Site/index.ts b/packages/core/src/Site/index.ts
index 6f2ff4f220..6ee9d3e06b 100644
--- a/packages/core/src/Site/index.ts
+++ b/packages/core/src/Site/index.ts
@@ -529,6 +529,7 @@ export class Site {
await this.copyOcticonsAsset();
await this.copyMaterialIconsAsset();
await this.writeSiteData();
+ // await this.indexSiteWithPagefind();
this.calculateBuildTimeForGenerate(startTime, lazyWebsiteGenerationString);
if (this.backgroundBuildMode) {
this.backgroundBuildNotViewedFiles();
@@ -569,6 +570,23 @@ export class Site {
}
}
+ /**
+ * Indexes all the pages of the site using pagefind
+ async indexSiteWithPagefind() {
+ const { createIndex, close } = await import('pagefind'); //eslint-disable-line
+ const newIndex = await createIndex({
+ keepIndexUrl: true,
+ verbose: true,
+ logfile: 'debug.log',
+ });
+ const { index } = newIndex;
+ if (index) {
+ await index.addDirectory({ path: this.outputPath });
+ await index.writeFiles({ outputPath: `${this.outputPath}/pagefind` });
+ }
+ await close();
+ } */
+
/**
* Adds all pages except the viewed pages to toRebuild, flagging them for lazy building later.
*/
diff --git a/packages/core/src/plugins/pageFind.ts b/packages/core/src/plugins/pageFind.ts
new file mode 100644
index 0000000000..eeaebbfff2
--- /dev/null
+++ b/packages/core/src/plugins/pageFind.ts
@@ -0,0 +1,32 @@
+import cheerio from 'cheerio';
+import { PluginContext } from './Plugin';
+
+const DEFAULT_UI = 'https://cdn.jsdelivr.net/npm/@pagefind/default-ui@1.0.4/+esm';
+
+function addPagefindUI() {
+ return `
+
+
+
+`;
+}
+
+export = {
+ tagConfig: {
+ pagefind: {
+ isSpecial: true,
+ },
+ },
+ postRender: (pluginContext: PluginContext, content: string) => {
+ const $ = cheerio.load(content);
+ $('header').append(addPagefindUI());
+ },
+};