mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-04 05:11:00 +00:00
docs + various polish
This commit is contained in:
parent
b90590b9f4
commit
08f8e3b4a4
49 changed files with 1365 additions and 196 deletions
quartz/plugins/transformers
|
@ -2,6 +2,7 @@ import matter from "gray-matter"
|
|||
import remarkFrontmatter from 'remark-frontmatter'
|
||||
import { QuartzTransformerPlugin } from "../types"
|
||||
import yaml from 'js-yaml'
|
||||
import { slug as slugAnchor } from 'github-slugger'
|
||||
|
||||
export interface Options {
|
||||
language: 'yaml' | 'toml',
|
||||
|
@ -29,10 +30,18 @@ export const FrontMatter: QuartzTransformerPlugin<Partial<Options> | undefined>
|
|||
}
|
||||
})
|
||||
|
||||
// tag is an alias for tags
|
||||
if (data.tag) {
|
||||
data.tags = data.tag
|
||||
}
|
||||
|
||||
if (data.tags && !Array.isArray(data.tags)) {
|
||||
data.tags = data.tags.toString().split(",").map((tag: string) => tag.trim())
|
||||
}
|
||||
|
||||
// slug them all!!
|
||||
data.tags = data.tags?.map((tag: string) => slugAnchor(tag)) ?? []
|
||||
|
||||
// fill in frontmatter
|
||||
file.data.frontmatter = {
|
||||
title: file.stem ?? "Untitled",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue