Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from paveg/footnote
Browse files Browse the repository at this point in the history
  • Loading branch information
paveg authored Mar 18, 2024
2 parents da14329 + 993d11e commit 5726b17
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 10 deletions.
17 changes: 16 additions & 1 deletion components/category-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@ type Props = {
badgeString?: string;
};

type BadgeTypes =
type CategoryTypes =
| 'Technology'
| 'Programming'
| 'Productivity'
| 'Lifestyle'
| 'Gadgets'
| 'Other';
const ALL_CATEGORIES = [
'Technology',
'Programming',
'Productivity',
'Lifestyle',
'Gadgets',
'Other',
];

function isSuit(value: string) {
return ALL_CATEGORIES.includes(value);
}

const toPascalCase = (str: string) => {
return [str]
Expand All @@ -20,5 +32,8 @@ const toPascalCase = (str: string) => {

export const CategoryBadge = ({ badgeString }: Props) => {
const bs = badgeString ? toPascalCase(badgeString) : 'Other';
if (!isSuit(bs)) {
return <Badge variant="secondary">Other</Badge>;
}
return <Badge variant="secondary">{bs}</Badge>;
};
18 changes: 9 additions & 9 deletions content/posts/sample.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ export const SampleComponent = ({ children }: Props) => {

This is a `code` inline.

## footnote

This is a sample post. [^1]

[^1]: This is a footnote.

## Table

| Name | Age | Sex |
| ---- | --- | --- |
| John | 20 | M |
| Jane | 22 | F |
| :--- | :-: | --: |
| John | 20 | M |
| Jane | 22 | F |

## Lists

Expand Down Expand Up @@ -83,12 +89,6 @@ _italic_

---

## footnote

This is a sample post.

[^1]: This is a footnote.

## Line Break

This line includes a line<br/>break.
Expand Down
8 changes: 8 additions & 0 deletions contentlayer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import rehypeSlug from 'rehype-slug';
import rehypePrism from 'rehype-prism-plus';
import rehypeCodeTitles from 'rehype-code-titles';
import readingTime from 'reading-time';
import remarkFootnotes from 'remark-footnotes';
import remarkGfm from 'remark-gfm';

/** @type {import('contentlayer/source-files').ComputedFields} */
const computedFields = {
Expand Down Expand Up @@ -61,6 +63,12 @@ export default makeSource({
contentDirPath: './content',
documentTypes: [Post, Page],
mdx: {
remarkPlugins: [
// remark-gfm 4.0.0 has an issue to render table.
// @see https://github.com/remarkjs/remark-gfm/issues/57
remarkGfm,
[remarkFootnotes, { inlineNotes: true }],
],
rehypePlugins: [
rehypeSlug,
rehypeCodeTitles,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"rehype-prism-plus": "^2.0.0",
"rehype-slug": "^6.0.0",
"remark-footnotes": "^4.0.1",
"remark-gfm": "^3.0.1",
"tailwind-merge": "^2.2.1",
"tailwindcss": "3.3.2",
"tailwindcss-animate": "^1.0.7",
Expand Down
211 changes: 211 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# *
User-agent: *
Allow: /

# Host
Host: https://www.funailog.com

# Sitemaps
Sitemap: https://www.funailog.com/sitemap.xml
8 changes: 8 additions & 0 deletions public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://www.funailog.com/api/hello</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/about</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/posts/sample</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/posts/without-category-post</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
4 changes: 4 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://www.funailog.com/sitemap-0.xml</loc></sitemap>
</sitemapindex>

0 comments on commit 5726b17

Please sign in to comment.