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

Commit

Permalink
Add changes for footnote feature
Browse files Browse the repository at this point in the history
  • Loading branch information
paveg committed Mar 18, 2024
1 parent cadbb70 commit 360784d
Show file tree
Hide file tree
Showing 4 changed files with 3,343 additions and 1,035 deletions.
14 changes: 7 additions & 7 deletions content/posts/sample.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ 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 |

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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"rehype-code-titles": "^1.2.0",
"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
Loading

0 comments on commit 360784d

Please sign in to comment.