Skip to content

Commit 1b7248a

Browse files
ovflowdmikeesto
andauthored
meta: removed old deps, updated deps, added shiki (#5725)
* meta: removed old deps, updated deps, added shiki * feat: introduced shiki and rehype pretty code * feat: updated styles for shiki * fix: jest setup for new version of js-dom * feat: introduced rehype-pretty-code * chore: some css changes for the codeboxes * chore: use shiki theme hosted by us * fix: shiki included on deployment * meta: undo changes * fix: include shiki languages that we use manually * chore: manuall import grammar * meta: removed unsupported languages * chore: updated text * chore: better docs * fix: fallback to plaintext * fix: white mode colour for codeblock * meta: ignore certain files * fix: fixed styles for inline code and etc --------- Co-authored-by: Michael Esteban <[email protected]>
1 parent 2e70cb5 commit 1b7248a

File tree

13 files changed

+1516
-1564
lines changed

13 files changed

+1516
-1564
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ node_modules
66
.swc
77
build
88

9-
# Legacy Public Files
10-
public/static/documents
9+
# Public Files
10+
public/node-releases-data.json
11+
public/blog-posts-data.json
1112

1213
# We don't want to lint/prettify the Coverage Results
1314
coverage

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ build
99
# Files that should not be parsed
1010
CODEOWNERS
1111

12-
# Legacy Public Files
12+
# Public Files
1313
public/static/documents
1414
public/node-releases-data.json
15+
public/blog-posts-data.json
1516

1617
# We don't want to lint/prettify the Coverage Results
1718
coverage

jest.setup.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import '@testing-library/jest-dom/extend-expect';
1+
import '@testing-library/jest-dom';

next.dynamic.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
import { join, normalize, sep } from 'node:path';
44
import { readFileSync } from 'node:fs';
55
import { VFile } from 'vfile';
6+
import { getHighlighter } from 'shiki';
67
import remarkGfm from 'remark-gfm';
78
import remarkHeadings from '@vcarl/remark-headings';
89
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
10+
import rehypePrettyCode from 'rehype-pretty-code';
911
import rehypeSlug from 'rehype-slug';
12+
import shikiNordTheme from 'shiki/themes/nord.json';
1013
import { serialize } from 'next-mdx-remote/serialize';
1114
import { availableLocales } from './next.locales.mjs';
1215
import { getMarkdownFiles } from './next.helpers.mjs';
1316
import { DEFAULT_LOCALE_CODE, MD_EXTENSION_REGEX } from './next.constants.mjs';
17+
import { SUPPORTED_LANGUAGES } from './shiki.config.mjs';
1418

1519
// allows us to run a glob to get markdown files based on a language folder
1620
const getPathsByLanguage = async (locale = DEFAULT_LOCALE_CODE, ignored = []) =>
@@ -162,6 +166,15 @@ export const generateStaticProps = async (source = '', filename = '') => {
162166
properties: { ariaHidden: true, tabIndex: -1, class: 'anchor' },
163167
},
164168
],
169+
[
170+
rehypePrettyCode,
171+
{
172+
theme: shikiNordTheme,
173+
defaultLang: 'plaintext',
174+
getHighlighter: options =>
175+
getHighlighter({ ...options, langs: SUPPORTED_LANGUAGES }),
176+
},
177+
],
165178
],
166179
remarkPlugins: [remarkGfm, remarkHeadings],
167180
format: filename.includes('.mdx') ? 'mdx' : 'md',

0 commit comments

Comments
 (0)