-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
104 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: 创建你的网站 | ||
--- | ||
|
||
安装 PageForge 后,你可以使用它来创建你的网站。您需要跳转到需要创建网站的文件夹,该文件夹必须是一个空文件夹。然后,您可以使用 PageForge 的命令行工具来创建网站。 | ||
|
||
我们假设您的文件夹是 `my-website`。 | ||
|
||
```bash | ||
pageforge init | ||
``` | ||
|
||
或者 | ||
|
||
```bash | ||
pageforge create-site . | ||
``` | ||
|
||
或者指定文件夹路径 | ||
|
||
```bash | ||
pageforge create-site my-website | ||
``` | ||
|
||
安装完成后,它将是如下目录结构: | ||
|
||
``` | ||
├── content | ||
│ └── index.md | ||
└── pageforge.yaml | ||
``` | ||
|
||
然后,您可以使用 `pageforge build` 命令来构建网站,或者使用 `pageforge serve` 命令来预览网站。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const {marked} = require("marked"); | ||
const {loadComponent} = require("../../component-loader"); | ||
|
||
const PageForgeCodeExtension = { | ||
name: 'pageforgeCode', | ||
level: 'inline', | ||
start(src) { | ||
return src.match(/.*`/)?.index; // 匹配任何以反引号结尾的内容 | ||
}, | ||
tokenizer(src, tokens) { | ||
// 匹配格式:任何文本 + `代码` + 任何文本,直到行尾或下一个反引号 | ||
const rule = /(.*?)`([^`]+)`([^`\n]*)/; | ||
const match = rule.exec(src); | ||
|
||
if (match && !src.startsWith('```')) { | ||
return { | ||
type: 'pageforgeCode', | ||
raw: match[0], | ||
prefix: match[1], // 代码前的文本 | ||
text: match[2], // 代码内容 | ||
suffix: match[3], // 代码后的文本 | ||
tokens: [] | ||
}; | ||
} | ||
return false; | ||
}, | ||
renderer(item) { | ||
return item.prefix + loadComponent('code', {text: item.text}) + item.suffix; | ||
} | ||
}; | ||
|
||
marked.use({ | ||
extensions: [ | ||
PageForgeCodeExtension | ||
], | ||
breaks: true | ||
}); | ||
|
||
module.exports = PageForgeCodeExtension; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function template(item) { | ||
return ` | ||
<code class="bg-gray-100 text-gray-900 px-1.5 py-0.5 rounded text-sm font-mono inline"> | ||
${item.text} | ||
</code> | ||
`; | ||
}; |