-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4983db2
commit dceacc4
Showing
13 changed files
with
167 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
/dist | ||
|
||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Tutorial plugin | ||
|
||
This is a small plugin to register tutorials to be listed on the tutorial page plugin. | ||
|
||
## Usage | ||
|
||
``` | ||
yarn add @iota-wiki/plugin-tutorial | ||
``` | ||
|
||
Then register any tutorials to list on the tutorial page by providing information like the titles, routes and metadata of the tutorials: | ||
|
||
```js | ||
plugins: [ | ||
[ | ||
'@iota-wiki/plugin-tutorial', | ||
{ | ||
title: "EVM Tutorial", | ||
description: | ||
"In this tutorial, you will learn how to use the EVM in IOTA.", | ||
route: "evm-tutorial/intro", | ||
tags: ["text"], | ||
source: "https://github.com/dr-electron/tutorial-template", // Optional | ||
preview: "evm-tutorial.png", // Optional | ||
}, | ||
], | ||
... | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@iota-wiki/plugin-tutorial", | ||
"version": "1.0.6", | ||
"main": "dist/index.js", | ||
"types": "src/types.d.ts", | ||
"scripts": { | ||
"clean": "rm -rf ./lib", | ||
"build": "tsc --build", | ||
"prepack": "yarn build" | ||
}, | ||
"packageManager": "yarn@3.2.2", | ||
"devDependencies": { | ||
"@docusaurus/types": "2.2.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src/types.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { | ||
OptionValidationContext, | ||
LoadContext, | ||
Plugin, | ||
} from '@docusaurus/types'; | ||
|
||
import type { NormalizedOptions, UserOptions } from './types'; | ||
|
||
export default async function pluginTutorial( | ||
context: LoadContext, | ||
options: NormalizedOptions, | ||
): Promise<Plugin> { | ||
return { | ||
name: '@iota-wiki/plugin-tutorial', | ||
async contentLoaded({ actions }) { | ||
actions.setGlobalData(options); | ||
}, | ||
}; | ||
} | ||
|
||
export function validateOptions({ | ||
options: userOptions, | ||
}: OptionValidationContext<UserOptions, NormalizedOptions>): NormalizedOptions { | ||
const id = userOptions.title.normalize().toLowerCase().replace(/\W/, '-'); | ||
|
||
const defaultOptions = { | ||
id, | ||
route: id, | ||
}; | ||
|
||
return Object.assign(defaultOptions, userOptions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export interface Options { | ||
title: string; | ||
description: string; | ||
tags: string[]; | ||
source?: string; | ||
preview?: string; | ||
} | ||
|
||
export interface DefaultOptions { | ||
id: string; | ||
route: string; | ||
} | ||
|
||
export type UserOptions = Options & Partial<DefaultOptions>; | ||
export type NormalizedOptions = Options & DefaultOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2019", | ||
"module": "NodeNext", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"rootDir": "src", | ||
"outDir": "dist", | ||
"declaration": true | ||
}, | ||
"include": ["src"] | ||
} |
Oops, something went wrong.