Skip to content

Commit

Permalink
feat: hidden content & import external markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
djdjz7 committed Dec 28, 2024
1 parent 94f76ec commit 5519bd2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion generator/page-list-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export default function pageListGenerator(routeBase: string[]): PluginOption {
.map((entry) => {
return { entry, frontmatter: matter.read(entry, { excerpt: true }) }
})
.map((file): PageData => {
.map((file): PageData | undefined => {
const { entry, frontmatter } = file
if (frontmatter.data.hidden) return undefined
const filename = path.parse(entry).name
const data = frontmatter.data
const time = data.time
Expand All @@ -45,6 +46,7 @@ export default function pageListGenerator(routeBase: string[]): PluginOption {
contentUrl: `/${base}/${filename}`,
}
})
.filter((page) => page !== undefined)
.sort((a, b) => Date.parse(b.time) - Date.parse(a.time)),
})
}
Expand Down
13 changes: 13 additions & 0 deletions src/data/activities/referenced-markdown-content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
hidden: true
---

**BEGIN IMPORTED SECTION**

### This section is from an external markdown file

::: info
testing whether we could import an external markdown file.
:::

**END IMPORTED SECTION**
9 changes: 9 additions & 0 deletions src/data/activities/the-ultimate-markdown-benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ def hello_world():

## Extended Markdown Syntax

### Importing External Markdown Files

The file is [here](./referenced-markdown-content)

<div p-x-4 p-y-1 box-border rounded-md bg-gray-100 dark:bg-truegray-800>
<ExternalContent />
</div>

### More Code Blocks

```js
Expand Down Expand Up @@ -230,6 +238,7 @@ ADD ONE!
import { ref } from 'vue'
import ProjectCard from '@/components/ProjectCard.vue'
import type { Project } from '@/data/project'
import ExternalContent from './referenced-markdown-content.md'
const count = ref(0)
const project : Project = {
title: '>_<',
Expand Down

0 comments on commit 5519bd2

Please sign in to comment.