Skip to content

Commit

Permalink
[repo] Move to Docusaurus 3.0.0-alpha.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jun 19, 2023
1 parent 1945bc4 commit 9596203
Show file tree
Hide file tree
Showing 12 changed files with 5,530 additions and 2,129 deletions.
6 changes: 4 additions & 2 deletions config/prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
*/
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const { themes } = require('prism-react-renderer');

const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

module.exports = {
theme: lightCodeTheme,
Expand Down
3 changes: 1 addition & 2 deletions docs/guides/javascript/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ Any time that this template is rendered and placed on the page the `mod_forum/di

:::note Since Moodle 4.0
Moodle no longer supports Internet Explorer. It's now safe to use Arrow functions.
<!--
TODO:
<!-- TODO:
Moodle no longer supports Internet Explorer. It's now safe to use <Term reference="arrowFunctions">Arrow functions</Term>.
-->
:::
Expand Down
6 changes: 2 additions & 4 deletions general/releases/2.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ Finally, thanks to all our testers both within Moodle HQ and from the whole comm

Credits to Moodle HQ: Marina Glancy, Barbara Ramiro, Martin Dougiamas, David Mudrak, Dongsheng Cai and others.

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down Expand Up @@ -100,8 +99,7 @@ Credits to Moodle HQ: Dongsheng Cai, Marina Glancy, Martin Dougiamas, Petr Skoda

Credits to: Andrew Nicols and Ruslan Kabalin (LUNS) Davo Smith (Synergy Learning), Dan Poltawski and Martin Dougiamas (Moodle HQ)

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down
3 changes: 1 addition & 2 deletions general/releases/2.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ See [MDL-36504](https://tracker.moodle.org/browse/MDL-36504) for the full list o
- [MDL-38391](https://tracker.moodle.org/browse/MDL-38391) - Improved YUI module loading performance
- [MDL-37127](https://tracker.moodle.org/browse/MDL-37127) - Use of minified YUI modules to reduce content size

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down
3 changes: 1 addition & 2 deletions general/releases/2.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ Many important changes have been made to improve Moodle's performance: a new ses
- [MDL-37028](https://tracker.moodle.org/browse/MDL-37028) - Integrity check of course data on-the-fly plus CLI script
- [MDL-42387](https://tracker.moodle.org/browse/MDL-42387) - Standardised file lifetime handling

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down
6 changes: 2 additions & 4 deletions general/releases/3.0/3.0.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ PHP 7 was released on 3 December 2015 and is still very young. Not all libraries

**PHP 7 compatibility makes Moodle faster**

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down Expand Up @@ -49,8 +48,7 @@ PHP 7 was released on 3 December 2015 and is still very young. Not all libraries

**PHP 7 compatibility significantly reduces memory used**

<!--
Github Flavoured Markdown does not support tables without headers.
<!-- Github Flavoured Markdown does not support tables without headers.
We must use an HTML table here.
Please note that Spacing in this table is important.
Markdown must have empty newlines between it and HTML markup.
Expand Down
67 changes: 34 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,26 @@
"spell": "cspell '*.md' '*.mdx' '**/*.md' '**/*.mdx' 'docs/*.md' 'docs/*.mdx' 'docs/**/*.md' 'docs/**/*.mdx' 'general/*.md' 'general/*.mdx' 'general/**/*.md' 'general/**/*.mdx'"
},
"dependencies": {
"@docusaurus/core": "latest",
"@docusaurus/plugin-pwa": "latest",
"@docusaurus/preset-classic": "latest",
"@docusaurus/theme-mermaid": "latest",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mdx-js/react": "^1.6.22",
"@mui/icons-material": "^5.10.16",
"@mui/material": "^5.10.16",
"@docusaurus/core": "canary",
"@docusaurus/plugin-pwa": "canary",
"@docusaurus/preset-classic": "canary",
"@docusaurus/theme-mermaid": "canary",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mdx-js/react": "^2.3.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.5",
"clsx": "^1.2.1",
"commander": "5.1.0",
"dotenv": "^16.0.3",
"hast-util-from-parse5": "^7.1.0",
"hast-util-from-parse5": "^7.1.2",
"libxmljs2": "^0.31.0",
"prism-react-renderer": "^1.3.5",
"prism-react-renderer": "^2.0.5",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-player": "^2.11.0"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-player": "^2.12.0",
"unist-util-visit": "^4.1.2"
},
"browserslist": {
"production": [
Expand All @@ -66,28 +67,28 @@
},
"devDependencies": {
"@apidevtools/json-schema-ref-parser": "^9.1.0",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@docusaurus/module-type-aliases": "latest",
"@tsconfig/docusaurus": "^1.0.6",
"@babel/plugin-transform-runtime": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@docusaurus/module-type-aliases": "canary",
"@tsconfig/docusaurus": "^1.0.7",
"@types/core-js": "^2.5.5",
"@types/node": "^18.11.10",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@types/node": "^20.3.1",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"ajv-cli": "^5.0.0",
"babel-jest": "^29.3.1",
"babel-jest": "^29.5.0",
"cspell": "^6.15.1",
"eslint": "^8.28.0",
"eslint": "^8.43.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.6",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-mdx": "^1.17.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-mdx": "^2.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-regexp": "^1.11.0",
"husky": "^8.0.2",
"eslint-plugin-regexp": "^1.15.0",
"husky": "^8.0.3",
"inquirer": "^9.1.4",
"jest": "^29.3.1",
"js-yaml": "^4.1.0",
Expand All @@ -98,9 +99,9 @@
"nodemw": "^0.18.0",
"stylelint": "^14.15.0",
"stylelint-config-standard": "^29.0.0",
"ts-jest": "^29.0.3",
"typescript": "^4.9.3",
"unist-util-inspect": "7.0.1",
"ts-jest": "^29.1.0",
"typescript": "^5.1.3",
"unist-util-inspect": "7.0.2",
"winston": "^3.8.2"
},
"packageManager": "[email protected]"
Expand Down
45 changes: 42 additions & 3 deletions src/remark/moodleBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,50 @@
*/

module.exports = () => (root) => {
const attributes = [
{
type: 'mdxJsxAttribute',
name: 'frontMatter',
value: '{frontMatter}',
},
];

if (typeof metadata !== 'undefined') {
attributes.push({
type: 'mdxJsxAttribute',
name: 'metadata',
value: '{metadata}',
});
}

root.children.unshift({
type: 'import',
type: 'mdxjsEsm',
value: 'import MoodlePageBanner from "@site/src/theme/MoodlePageBanner";',
data: {
estree: {
type: 'Program',
body: [
{
type: 'ImportDeclaration',
specifiers: [
{
type: 'ImportDefaultSpecifier',
local: { type: 'Identifier', name: 'MoodlePageBanner' },
},
],
source: {
type: 'Literal',
value: '@site/src/theme/MoodlePageBanner',
raw: "'@site/src/theme/MoodlePageBanner'",
},
},
],
sourceType: 'module',
},
},
}, {
type: 'jsx',
value: '<MoodlePageBanner frontMatter={frontMatter} {...(typeof metadata !== "undefined" ? {metadata} : {} )}/>',
type: 'mdxJsxFlowElement',
name: 'MoodlePageBanner',
attributes,
});
};
8 changes: 3 additions & 5 deletions src/remark/trackerLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
* along with Moodle. If not, see <http://www.gnu.org/licenses/>.
*/

/* eslint-disable-next-line import/no-extraneous-dependencies */
const visit = require('unist-util-visit');

const projects = [
'MDL',
'MDLQA',
Expand Down Expand Up @@ -61,7 +58,7 @@ const updateTextLink = (node, index, parent) => {
return 'skip';
}

const expression = new RegExp(`(?<issueNumber>(${projects.join('|')})-\\d+)`, 'g');
const expression = new RegExp(`(?<issueNumber>(${projects.join('|')})-\\d+)`);
const match = expression.exec(value);
if (match === null) {
// No matches found in this node, so skip this one, but keep processing.
Expand All @@ -86,7 +83,8 @@ const updateTextLink = (node, index, parent) => {
return index + 2;
};

const plugin = () => {
const plugin = async () => {
const { visit } = await import('unist-util-visit');
const transformer = async (ast) => {
// Visit all nodes on the AST which are of type 'text' and apply the updateTextLink function on them.
// The visit function's third parameter is a Visitor function.
Expand Down
4 changes: 0 additions & 4 deletions versioned_docs/version-4.1/guides/javascript/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ Any time that this template is rendered and placed on the page the `mod_forum/di

:::note Since Moodle 4.0
Moodle no longer supports Internet Explorer. It's now safe to use Arrow functions.
<!--
TODO:
Moodle no longer supports Internet Explorer. It's now safe to use <Term reference="arrowFunctions">Arrow functions</Term>.
-->
:::

Often you may want to link the JavaScript to a specific `DOMElement` in the template.
Expand Down
4 changes: 0 additions & 4 deletions versioned_docs/version-4.2/guides/javascript/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ Any time that this template is rendered and placed on the page the `mod_forum/di

:::note Since Moodle 4.0
Moodle no longer supports Internet Explorer. It's now safe to use Arrow functions.
<!--
TODO:
Moodle no longer supports Internet Explorer. It's now safe to use <Term reference="arrowFunctions">Arrow functions</Term>.
-->
:::

Often you may want to link the JavaScript to a specific `DOMElement` in the template.
Expand Down
Loading

0 comments on commit 9596203

Please sign in to comment.