-
Notifications
You must be signed in to change notification settings - Fork 6
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
280 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,13 @@ | |
"title": "Ter", | ||
"description": "A tiny wiki-style site builder with Zettelkasten flavor", | ||
"url": "https://ter.kkga.me/", | ||
"author_name": "Gadzhi Kharkharov", | ||
"author_email": "[email protected]", | ||
"author_url": "https://kkga.me/", | ||
"nav_links": { | ||
"authorName": "Gadzhi Kharkharov", | ||
"authorEmail": "[email protected]", | ||
"authorUrl": "https://kkga.me/", | ||
"navLinks": { | ||
"Usage": "/usage", | ||
"Source": "https://github.com/kkga/ter" | ||
}, | ||
"codeHighlight": true, | ||
"head": "<script data-host='https://microanalytics.io' data-dnt='false' src='https://microanalytics.io/js/script.js' id='ZwSg9rf6GA' async defer></script>" | ||
} |
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 |
---|---|---|
|
@@ -6,9 +6,10 @@ const defaultUserConfig: UserConfig = { | |
description: "I am writing about my experiences as a naval navel-gazer", | ||
url: "https://example.com/", | ||
rootCrumb: "index", | ||
author_name: "Your Name Here", | ||
author_email: "[email protected]", | ||
author_url: "https://example.com/about-me/", | ||
authorName: "Your Name Here", | ||
authorEmail: "[email protected]", | ||
authorUrl: "https://example.com/about-me/", | ||
codeHighlight: false, | ||
lang: "en", | ||
}; | ||
|
||
|
@@ -76,11 +77,11 @@ export async function createConfig( | |
conf.renderDrafts = opts.renderDrafts; | ||
|
||
await checkUserConfig(conf.userConfigPath) | ||
.catch(async () => { | ||
.catch(() => { | ||
console.warn( | ||
`Config file missing, initializing default config at ${conf.userConfigPath}`, | ||
); | ||
await initUserConfig(conf.userConfig, conf.userConfigPath); | ||
initUserConfig(conf.userConfig, conf.userConfigPath); | ||
}); | ||
|
||
try { | ||
|
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 |
---|---|---|
|
@@ -22,32 +22,32 @@ Navigate to a directory with some markdown files and run Ter to build a site. | |
This command will recursively search for all `*.md` files in the current | ||
directory and generate a site into the `_site` directory: | ||
|
||
```sh | ||
``` | ||
deno run -A --unstable https://deno.land/x/ter/main.ts | ||
``` | ||
|
||
If your markdown files are not in root directory, or if you want a different | ||
name for the output directory, adjust accordingy, for example: | ||
|
||
```sh | ||
``` | ||
deno run -A --unstable https://deno.land/x/ter/main.ts --input pages --output _dist | ||
``` | ||
|
||
To start a local server with live refresh, pass the `--serve` flag: | ||
|
||
```sh | ||
``` | ||
deno run -A --unstable https://deno.land/x/ter/main.ts --serve | ||
``` | ||
|
||
## Command line usage | ||
|
||
Run Ter with the `--help` flag to see usage reference. | ||
|
||
```sh | ||
``` | ||
deno run https://deno.land/x/ter/main.ts --help | ||
``` | ||
|
||
```sh | ||
``` | ||
Ter -- tiny wiki-style site builder | ||
USAGE: | ||
|
@@ -73,35 +73,37 @@ building. | |
|
||
### Options | ||
|
||
| Key | Description | | ||
| -------------- | --------------------------------------------------------------------- | | ||
| `title` | Title of your site. | | ||
| `description` | Description of your site. | | ||
| `url` | Published URL address of your site. | | ||
| `rootCrumb` | Label used for root crumb label (default: "index"). | | ||
| `author_name` | Your name. | | ||
| `author_email` | Your email. | | ||
| `author_url` | Your home page. | | ||
| `lang` | Optional. [Locale][locale] used for formatting dates. | | ||
| `nav_links` | Optional. Object of navigation links in form of `{label: path, ...}`. | | ||
| `head` | Optional. String to inject at the bottom of `<head>` tag. | | ||
| Key | Description | | ||
| ------------- | --------------------------------------------------------------------- | | ||
| title | Title of your site. | | ||
| description | Description of your site. | | ||
| url | Published URL address of your site. | | ||
| rootCrumb | Label used for root crumb label (default: "index"). | | ||
| authorName | Your name. | | ||
| authorEmail | Your email. | | ||
| authorUrl | Your home page. | | ||
| lang | Optional. [Locale][locale] used for formatting dates. | | ||
| navLinks | Optional. Object of navigation links in form of `{label: path, ...}`. | | ||
| codeHighlight | Optional. Use syntax highlighting in code blocks (default: false). | | ||
| head | Optional. String to inject at the bottom of `<head>` tag. | | ||
|
||
[locale]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument | ||
|
||
### Example | ||
|
||
```json | ||
{ | ||
title: "Your Blog Name", | ||
description: "I am writing about my experiences as a naval navel-gazer", | ||
url: "https://example.com/", | ||
rootCrumb: "index", | ||
author_name: "Your Name Here", | ||
author_email: "[email protected]", | ||
author_url: "https://example.com/about-me/", | ||
lang: "en", | ||
nav_links: { "about": "/about", "contact": "/contact" }, | ||
head: "<script src='https://microanalytics.io/js/script.js' id='XXXXXXXX'></script>" | ||
"title": "Your Blog Name", | ||
"description": "I am writing about my experiences as a naval navel-gazer", | ||
"url": "https://example.com/", | ||
"rootCrumb": "index", | ||
"authorName": "Your Name Here", | ||
"authorEmail": "[email protected]", | ||
"authorUrl": "https://example.com/about-me/", | ||
"lang": "en", | ||
"navLinks": { "about": "/about", "contact": "/contact" }, | ||
"codeHighlight": true, | ||
"head": "<script src='https://microanalytics.io/js/script.js' id='XXXXXXXX'></script>" | ||
} | ||
``` | ||
|
||
|
@@ -142,7 +144,7 @@ pages. | |
Ter extracts [YAML frontmatter](https://jekyllrb.com/docs/front-matter/) | ||
delimited by `---` from markdown files. Here’s an example: | ||
|
||
```markdown | ||
```yaml | ||
--- | ||
title: My page | ||
description: Here’s my description | ||
|
@@ -154,28 +156,26 @@ property: value | |
--- | ||
|
||
## My content | ||
|
||
... | ||
``` | ||
|
||
Some properties are utilized when building a site. All of them are optional. | ||
|
||
| Property | Default | Description | | ||
| ----------------- | ------- | ------------------------------------------------------------------------- | | ||
| `title` | | page title | | ||
| `description` | | page description | | ||
| `tags` | | page tags | | ||
| `date` | | page publish date in YYYY-MM-DD format | | ||
| `dateUpdated` | | page last update date in YYYY-MM-DD format | | ||
| `pinned` | `false` | page is listed at the top of [index lists](#index-pages) | | ||
| `unlisted` | `false` | page is excluded from all index lists | | ||
| `draft` | `false` | file is [ignored](#ignoring-files) during site generation | | ||
| `log` | `false` | if set on an index page (`index.md`), all child pages are rendered inline | | ||
| `toc` | `false` | affects rending of table of contents | | ||
| `showHeader` | `true` | affects rendering of page header with title, description, date and tags | | ||
| `showTitle` | `true` | affects rendering of page title | | ||
| `showDescription` | `true` | affects rendering of page description | | ||
| `showMeta` | `true` | affects rendering of page date and tags | | ||
| Property | Default | Description | | ||
| --------------- | ------- | ----------------------------------------------------------------------- | | ||
| title | | page title | | ||
| description | | page description | | ||
| tags | | page tags | | ||
| date | | page publish date in YYYY-MM-DD format | | ||
| dateUpdated | | page last update date in YYYY-MM-DD format | | ||
| pinned | false | page is listed at the top of [index lists](#index-pages) | | ||
| unlisted | false | page is excluded from all index lists | | ||
| draft | false | file is [ignored](#ignoring-files) during site generation | | ||
| log | false | if set on an index page (index.md), all child pages are rendered inline | | ||
| toc | false | affects rending of table of contents | | ||
| showHeader | true | affects rendering of page header with title, description, date and tags | | ||
| showTitle | true | affects rendering of page title | | ||
| showDescription | true | affects rendering of page description | | ||
| showMeta | true | affects rendering of page date and tags | | ||
|
||
## Ignoring files | ||
|
||
|
@@ -196,7 +196,7 @@ deno run -A --unstable https://deno.land/x/ter/main.ts --serve --drafts | |
Ter automatically finds non-working internal links and lets you know about them | ||
after building a site. Here's an example output: | ||
|
||
```sh | ||
``` | ||
[...] | ||
Dead links: | ||
/overview -> /non-existent-page-name | ||
|
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