Skip to content

Commit 8526ec2

Browse files
committed
chore: Update dependencies and configuration files
1 parent 062b73a commit 8526ec2

File tree

6 files changed

+82
-4
lines changed

6 files changed

+82
-4
lines changed

docs/intro.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
sidebar_position: 1
33
---
44

5-
# Intro
5+
```bash npm2yarn
6+
npm install ts-graphviz
7+
```

docusaurus.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type * as Preset from '@docusaurus/preset-classic';
2+
import npm2yarn from '@docusaurus/remark-plugin-npm2yarn';
23
import type { Config } from '@docusaurus/types';
34
import { themes as prismThemes } from 'prism-react-renderer';
45

6+
57
const config: Config = {
68
title: 'ts-graphviz',
79
tagline: 'Graphviz libraries for TypeScript',
@@ -27,11 +29,22 @@ const config: Config = {
2729
sidebarPath: './sidebars.ts',
2830
editUrl:
2931
'https://github.com/ts-graphviz/ts-graphviz/tree/main/website/',
32+
remarkPlugins: [
33+
[npm2yarn, { sync: true, converters: ['yarn', 'pnpm'] }],
34+
],
3035
},
3136
blog: {
3237
showReadingTime: true,
3338
editUrl:
3439
'https://github.com/ts-graphviz/ts-graphviz/tree/main/website/',
40+
remarkPlugins: [
41+
[npm2yarn, { sync: true, converters: ['yarn', 'pnpm'] }],
42+
],
43+
},
44+
pages: {
45+
remarkPlugins: [
46+
[npm2yarn, { sync: true, converters: ['yarn', 'pnpm'] }],
47+
],
3548
},
3649
theme: {
3750
customCss: './src/css/custom.css',
@@ -116,6 +129,7 @@ const config: Config = {
116129
prism: {
117130
theme: prismThemes.github,
118131
darkTheme: prismThemes.dracula,
132+
additionalLanguages: ['dot'],
119133
},
120134
} satisfies Preset.ThemeConfig,
121135
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@docusaurus/core": "3.5.2",
1919
"@docusaurus/preset-classic": "3.5.2",
20+
"@docusaurus/remark-plugin-npm2yarn": "^3.5.2",
2021
"@mdx-js/react": "^3.0.0",
2122
"clsx": "^2.0.0",
2223
"prism-react-renderer": "^2.3.0",

pnpm-lock.yaml

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Link from '@docusaurus/Link';
2+
import Translate from '@docusaurus/Translate';
23
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
34
import HomepageFeatures from '@site/src/components/HomepageFeatures';
45
import Heading from '@theme/Heading';
@@ -15,12 +16,18 @@ function HomepageHeader() {
1516
<Heading as="h1" className="hero__title">
1617
{siteConfig.title}
1718
</Heading>
18-
<p className="hero__subtitle">{siteConfig.tagline}</p>
19+
<p className="hero__subtitle">
20+
<Translate id="index.tagline">
21+
{siteConfig.tagline}
22+
</Translate>
23+
</p>
1924
<div className={styles.buttons}>
2025
<Link
2126
className="button button--secondary button--lg"
2227
to="/docs/intro">
23-
ts-graphviz Tutorial - 5min ⏱️
28+
<Translate id="index.tutorial">
29+
ts-graphviz Tutorial - 5min ⏱️
30+
</Translate>
2431
</Link>
2532
</div>
2633
</div>
@@ -33,7 +40,7 @@ export default function Home(): JSX.Element {
3340
return (
3441
<Layout
3542
title={`Hello from ${siteConfig.title}`}
36-
description="Description will go into a meta tag in <head />">
43+
description={siteConfig.tagline}>
3744
<HomepageHeader />
3845
<main>
3946
<HomepageFeatures />
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import siteConfig from '@generated/docusaurus.config';
2+
import type * as PrismNamespace from 'prismjs';
3+
import type {Optional} from 'utility-types';
4+
5+
export default function prismIncludeLanguages(
6+
PrismObject: typeof PrismNamespace,
7+
): void {
8+
const {
9+
themeConfig: {prism},
10+
} = siteConfig;
11+
const {additionalLanguages} = prism as {additionalLanguages: string[]};
12+
13+
// Prism components work on the Prism instance on the window, while prism-
14+
// react-renderer uses its own Prism instance. We temporarily mount the
15+
// instance onto window, import components to enhance it, then remove it to
16+
// avoid polluting global namespace.
17+
// You can mutate PrismObject: registering plugins, deleting languages... As
18+
// long as you don't re-assign it
19+
globalThis.Prism = PrismObject;
20+
21+
additionalLanguages.forEach((lang) => {
22+
if (lang === 'php') {
23+
// eslint-disable-next-line global-require
24+
require('prismjs/components/prism-markup-templating.js');
25+
}
26+
// eslint-disable-next-line global-require, import/no-dynamic-require
27+
require(`prismjs/components/prism-${lang}`);
28+
});
29+
30+
delete (globalThis as Optional<typeof globalThis, 'Prism'>).Prism;
31+
}

0 commit comments

Comments
 (0)