Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update setup to docusaurus v3 #152

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
2 changes: 1 addition & 1 deletion deploy-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# catch errors
set -euo pipefail

nvm use 16
nvm use 18
npm install
npm run build
5 changes: 3 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
import { themes } from 'prism-react-renderer';

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down
22,225 changes: 12,709 additions & 9,516 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.1",
"@easyops-cn/docusaurus-search-local": "^0.33.6",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.1",
"react-dom": "^17.0.1"
"@docusaurus/core": "^3.1.0",
"@docusaurus/preset-classic": "^3.1.0",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.1.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion reference/02-Themes/block-template-parts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ All existing block template parts can be edited in the template part editor. Thi
:::info
The block template part editor also features an iframed editor. So the preview is actually accurate for what will happen on the frontend of the site.

If you are building custom blocks that utilize JavaScript DOM manipulations you can use this guide to learn more about how to work with this iframed context: <https://make.wordpress.org/core/2021/06/29/blocks-in-an-iframed-template-editor/>
If you are building custom blocks that utilize JavaScript DOM manipulations you can use this guide to learn more about how to work with this iframed context: [https://make.wordpress.org/core/2021/06/29/blocks-in-an-iframed-template-editor/](https://make.wordpress.org/core/2021/06/29/blocks-in-an-iframed-template-editor/)
:::

## How to enable block template parts
Expand Down
3 changes: 2 additions & 1 deletion training/06-inner-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ registerBlockType(block.name, {
});
```

Now that the content is saved in the database we also need to somehow use this content in our markup in PHP template. Inside our [`markup.php`[(<https://github.com/10up/gutenberg-lessons/tree/trunk/themes/tenup-theme/includes/blocks/inner-blocks-one-starter/markup.php>)] file we have access to a few variables. The `$attributes`, `$content`, `$block`, and `$context`. In this case we are interested in the `$content` variable which stores the saved markup from the editor.
Now that the content is saved in the database we also need to somehow use this content in our markup in PHP template. Inside our [`markup.php`[https://github.com/10up/gutenberg-lessons/tree/trunk/themes/tenup-theme/includes/blocks/inner-blocks-one-starter/markup.php](https://github.com/10up/gutenberg-lessons/tree/trunk/themes/tenup-theme/includes/blocks/inner-blocks-one-starter/markup.php) file we have access to a few variables. The `$attributes`, `$content`, `$block`, and `$context`. In this case we are interested in the `\
$content` variable which stores the saved markup from the editor.

If we look down at the content container, we will see the comment `// The inner blocks content should get rendered here.` Replace this comment with the following:

Expand Down
Loading