Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagefind #2477

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3330492
Add initial plugin
jingting1412 Mar 26, 2024
6cbda19
Add test
jingting1412 Mar 27, 2024
8371395
Fix plugin
jingting1412 Mar 27, 2024
f302eca
Update plugin
jingting1412 Mar 27, 2024
f06a25d
Update code
jingting1412 Mar 27, 2024
abac73f
Update code
jingting1412 Mar 27, 2024
c3453b1
Update plugin and test
jingting1412 Mar 27, 2024
09e8934
Remove old tests
jingting1412 Mar 27, 2024
d8e4936
Add pagefind as dependency
jingting1412 Mar 29, 2024
44fe0e0
Add pagefind as dependency
jingting1412 Mar 29, 2024
974795c
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Mar 29, 2024
db737a4
Merge branch 'addFullSearch' of https://github.com/jingting1412/markb…
jingting1412 Mar 29, 2024
106a5cd
Modify build process
jingting1412 Mar 29, 2024
a64819a
Change pagefind import
jingting1412 Mar 29, 2024
88489ba
Merge branch 'master' into addFullSearch
jingting1412 Mar 29, 2024
c198553
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Mar 30, 2024
106ca72
Merge branch 'addFullSearch' of https://github.com/jingting1412/markb…
jingting1412 Mar 30, 2024
a0c301c
Remove index.ts changes
jingting1412 Mar 30, 2024
b4f6d6c
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Apr 8, 2024
99d9ae2
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Apr 11, 2024
b15c6a5
Merge branch 'addFullSearch' of https://github.com/jingting1412/markb…
jingting1412 Apr 11, 2024
5e9fc03
Eslint ignore import
jingting1412 Apr 11, 2024
916b44e
Merge branch 'master' into addFullSearch
kaixin-hc Apr 12, 2024
caafbc5
Merge branch 'addFullSearch' of https://github.com/jingting1412/markb…
jingting1412 Apr 12, 2024
8ee05e7
change build process
jingting1412 Apr 12, 2024
6088950
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Apr 12, 2024
c618c38
Merge branch 'MarkBind:master' into addFullSearch
jingting1412 Apr 15, 2024
0725d76
Update implementation
jingting1412 Apr 15, 2024
fe5407e
Merge branch 'addFullSearch' of https://github.com/jingting1412/markb…
jingting1412 Apr 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modify build process
  • Loading branch information
jingting1412 committed Mar 29, 2024
commit 106a5cd84945611c42e611d08fc5fe343b8c4b3e
10 changes: 0 additions & 10 deletions packages/cli/src/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');

const { Site } = require('@markbind/core').Site;

const pagefind = require('pagefind');
const cliUtil = require('../util/cliUtil');
const logger = require('../util/logger');

Expand All @@ -27,15 +26,6 @@ function build(userSpecifiedRoot, output, options) {
.generate(baseUrl)
.then(() => {
logger.info('Build success!');
// Start Pagefind indexing after successful site generation
logger.info('Starting Pagefind indexing...');
const { index } = pagefind.createIndex({
keepIndexUrl: true,
verbose: true,
})
.then(() => index.addDirectory({ path: outputFolder }))
.then(() => index.writeFiles({ outputPath: path.join(outputFolder, 'pagefind') }))
.then(() => pagefind.close());
})
.catch((error) => {
logger.error(error.message);
Expand Down
23 changes: 23 additions & 0 deletions packages/cli/test/functional/test_site_pagefind/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
_markbind/logs/

# Dependency directories
node_modules/

# Production
_site/

# Env
.env
.env.local

# IDE configs
.vscode/
.idea/*
*.iml
7 changes: 7 additions & 0 deletions packages/cli/test/functional/test_site_pagefind/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<frontmatter>
title: Page not found
layout: 404.md
</frontmatter>

-><p style="font-size: 10rem">404</p><-
-><p style="font-size: 1.5rem">File not found<br>Click <a href="/">here</a> to go back to the home page.</p><-
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>{{ content }}</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<head-bottom>
<link rel="stylesheet" href="{{baseUrl}}/stylesheets/main.css">
</head-bottom>

<header sticky>
<navbar type="dark">
<a slot="brand" href="{{baseUrl}}/index.html" title="Home" class="navbar-brand">Your Logo</a>
<li><a href="{{baseUrl}}/contents/topic1.html" class="nav-link">Topic 1</a></li>
<li><a href="{{baseUrl}}/contents/topic2.html" class="nav-link">Topic 2</a></li>
<dropdown header="Topic 3" class="nav-link">
<li><a href="{{baseUrl}}/contents/topic3a.html" class="dropdown-item">Topic 3a</a></li>
<li><a href="{{baseUrl}}/contents/topic3b.html" class="dropdown-item">Topic 3b</a></li>
</dropdown>
<li slot="right">
<form class="navbar-form">
<searchbar :data="searchData" placeholder="Search" :on-hit="searchCallback" menu-align-right></searchbar>
</form>
</li>
</navbar>
</header>

<div id="flex-body">
<nav id="site-nav">
<div class="site-nav-top">
<div class="fw-bold mb-2" style="font-size: 1.25rem;">Contents</div>
</div>
<div class="nav-component slim-scroll">
<site-nav>
* [Home :house:]({{ baseUrl }}/index.html)
* [Topic 1]({{baseUrl}}/contents/topic1.html)
* [Topic 2]({{baseUrl}}/contents/topic2.html)
* Topic 3 :expanded:
* [Topic 3a]({{baseUrl}}/contents/topic3a.html)
* [Topic 3b]({{baseUrl}}/contents/topic3b.html)
</site-nav>
</div>
</nav>
<div id="content-wrapper">
<breadcrumb />
{{ content }}
</div>
<nav id="page-nav">
<div class="nav-component slim-scroll">
<page-nav />
</div>
</nav>
<scroll-top-button></scroll-top-button>
</div>

<footer>
<!-- Support MarkBind by including a link to us on your landing page! -->
<div class="text-center">
<small>[Generated by {{MarkBind}}]</small>
</div>
</footer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jsonVariableExample": "Your variables can be defined here as well"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<variable name="example">
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.
</variable>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<frontmatter>
title: Topic 1
</frontmatter>

<br>

# Topic 1

> This is a placeholder page - more content to be added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<frontmatter>
title: Topic 2
</frontmatter>

<br>

# Topic 2

> This is a placeholder page - more content to be added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<frontmatter>
title: Topic 3a
</frontmatter>

<br>

# Topic 3a

> This is a placeholder page - more content to be added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<frontmatter>
title: Topic 3b
</frontmatter>

<br>

# Topic 3b

> This is a placeholder page - more content to be added.
77 changes: 77 additions & 0 deletions packages/cli/test/functional/test_site_pagefind/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<frontmatter>
title: Home Page
layout: default.md
pageNav: 4
pageNavTitle: "Topics"
</frontmatter>

<br>

<div class="bg-primary text-white px-2 py-5 mb-4">
<div class="container">
<h1 class="display-5 no-index">Great!<br>You've just initialized a MarkBind site.</h1>
<p class="lead">Let's get started...</p>
</div>
</div>

---

## 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.

<box type="tip">

If you were intending to convert an existing GitHub wiki or a docs folder into MarkBind, use the `--convert` flag instead. See <a href="https://markbind.org/userGuide/markBindInTheProjectWorkflow.html#converting-existing-project-documentation-wiki" target="_blank">User Guide: MarkBind in the Project Workflow</a> for more information.

If you want to start with a <tooltip content="i.e. without any content">_minimal_</tooltip> template instead, use the `--template` flag with the "minimal" option to initialize a minimal site instead of the default. See <a href="https://markbind.org/userGuide/templates.html" target="_blank">User Guide: Templates</a> for more information.

</box>

---

## Navigating this site

This _default_ site comes pre-configured with the core <a href="https://markbind.org/userGuide/components/navigation.html#navigation-components" target="_blank">Navigation components</a>: a <tooltip content="Site Navigation">**siteNav**</tooltip>, a <tooltip content="Page Navigation">**pageNav**</tooltip>, a <tooltip content="Navigation Bar">**NavBar**</tooltip>, and a **Search Bar**. To help you get started with the **siteNav**, we have included <tooltip content="Topic 1, Topic 2, Topic 3, Topic 3a, Topic 3b">five dummy placeholder pages</tooltip>. 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 <a href="https://markbind.org/showcase.html" target="_blank">Showcase</a> page.

For more information on how to work with MarkBind sites and to add content, refer to our comprehensive <a href="https://markbind.org/userGuide/gettingStarted.html" target="_blank">User Guide</a>.

<box type="info">

If you are interested in contributing to MarkBind, you can refer to our <a href="https://markbind.org/devdocs/devGuide/devGuide.html" target="_blank">Developer Guide</a> as well!

</box>

<panel header="**Good starting points in our User Guide**" expanded no-close>

##### **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: _<a href="https://markbind.org/userGuide/authoringContents.html" target="_blank">User Guide → Authoring Contents</a>_

---

##### **User Guide: Working with Sites**

> Learn how to modify site properties, apply themes, and enable/disable plugins for your MarkBind site.

More info in: _<a href="https://markbind.org/userGuide/workingWithSites.html" target="_blank">User Guide → Working with Sites</a>_

---

##### **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: _<a href="https://markbind.org/userGuide/fullSyntaxReference.html" target="_blank">User Guide → Full Syntax Reference</a>_

</panel>

---
28 changes: 28 additions & 0 deletions packages/cli/test/functional/test_site_pagefind/site.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
Loading