1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

feat(posts): add git-ultimate-guide

This commit is contained in:
Divlo
2022-09-04 20:40:58 +02:00
parent c1877297f8
commit e85c241ed1
23 changed files with 9829 additions and 5019 deletions

View File

@ -53,8 +53,12 @@ export const getPosts = async (): Promise<PostMetadata[]> => {
})
)
const postsWithTimeSorted = postsWithTime
.filter((post) => post.frontmatter.isPublished)
.sort((a, b) => b.time - a.time)
.filter((post) => {
return post.frontmatter.isPublished
})
.sort((a, b) => {
return b.time - a.time
})
return postsWithTimeSorted
}
@ -62,7 +66,9 @@ export const getPostBySlug = async (
slug?: string | string[]
): Promise<Post | undefined> => {
const posts = await getPosts()
const post = posts.find((post) => post.slug === slug)
const post = posts.find((post) => {
return post.slug === slug
})
if (post == null) {
return undefined
}

View File

@ -1,7 +1,7 @@
import { Plugin, Transformer } from 'unified'
import { Literal } from 'unist'
import type { Plugin, Transformer } from 'unified'
import type { Literal } from 'unist'
import { visit } from 'unist-util-visit'
import { Highlighter } from 'shiki'
import type { Highlighter } from 'shiki'
export interface RemarkSyntaxHighlightingPluginOptions {
highlighter: Highlighter