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:
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user