From 6b558b2e3dcd3021589268d5916482bc1ff10f31 Mon Sep 17 00:00:00 2001 From: BinarySandia04 Date: Fri, 11 Oct 2024 12:50:46 +0200 Subject: [PATCH] Better docs --- documentation/docs/.vuepress/config.js | 45 +++++++++++++++- .../docs/.vuepress/styles/index.scss | 4 +- documentation/docs/client/test.md | 41 ++++++++++++++ .../docs}/firstplugin.md | 0 documentation/docs/get-started.md | 53 ++++--------------- documentation/docs/server/test.md | 1 + {tutorials => documentation/docs}/window.md | 0 tutorials/guides.md | 0 tutorials/howtoread.md | 3 -- tutorials/tutorials.json | 19 ------- tutorials/vdragonviews.md | 7 --- 11 files changed, 99 insertions(+), 74 deletions(-) create mode 100644 documentation/docs/client/test.md rename {tutorials => documentation/docs}/firstplugin.md (100%) create mode 100644 documentation/docs/server/test.md rename {tutorials => documentation/docs}/window.md (100%) delete mode 100644 tutorials/guides.md delete mode 100644 tutorials/howtoread.md delete mode 100644 tutorials/tutorials.json delete mode 100644 tutorials/vdragonviews.md diff --git a/documentation/docs/.vuepress/config.js b/documentation/docs/.vuepress/config.js index b1151987..d3ea143c 100644 --- a/documentation/docs/.vuepress/config.js +++ b/documentation/docs/.vuepress/config.js @@ -1,6 +1,7 @@ import { defaultTheme } from '@vuepress/theme-default' import { defineUserConfig } from 'vuepress/cli' import { viteBundler } from '@vuepress/bundler-vite' +import { prismjsPlugin } from '@vuepress/plugin-prismjs' export default defineUserConfig({ lang: 'en-US', @@ -12,8 +13,50 @@ export default defineUserConfig({ logo: '/images/logo-light.png', logoDark: '/images/logo.png', - navbar: ['/', '/get-started'], + navbar: [ + { + text: "Guides", + prefix: "/guide/", + link: "/guide/", + children: ['/get-started'] + }, + + { + text: "Reference", + prefix: "/api/", + link: "/api/", + children: [ + { + text: "Plugin", + prefix: "plugin/", + collapsable: true, + children: ['/client/test'] + }, + { + text: "Client API", + prefix: "client/", + collapsable: true, + children: ['/client/test'] + }, + { + text: "Server API", + prefix: "server/", + children: ['/server/test'] + } + ] + } + ], + + repo: 'https://git.aranroig.com/BinarySandia04/dragonroll', }), bundler: viteBundler(), + plugins: [ + prismjsPlugin({ + themes: { + light: 'duotone-light', + dark: 'duotone-space' + } + }) + ] }) diff --git a/documentation/docs/.vuepress/styles/index.scss b/documentation/docs/.vuepress/styles/index.scss index 24018dd4..65ac5bfd 100644 --- a/documentation/docs/.vuepress/styles/index.scss +++ b/documentation/docs/.vuepress/styles/index.scss @@ -1,4 +1,6 @@ // === colors === +@import '~prismjs/themes/prism-dark.css'; + :root { // accent colors --vp-c-accent: #E13F65; @@ -87,7 +89,7 @@ --vp-c-accent-soft: rgba(185, 64, 16, 0.16); // background colors - --vp-c-bg: #1b1b1f; + --vp-c-bg: #181818; --vp-c-bg-alt: #161618; --vp-c-bg-elv: #202127; diff --git a/documentation/docs/client/test.md b/documentation/docs/client/test.md new file mode 100644 index 00000000..e309c384 --- /dev/null +++ b/documentation/docs/client/test.md @@ -0,0 +1,41 @@ +# Updating a resource + +## Request + +- HTTP Method: `PUT` +- Content Type: `application/json` +- URL: `http://example.com/users/{id}` + +## Parameters + +| Property | Type | Required | Description | +| -------- | ---- | -------- | ----------- | +| ``name`` | String | false | The name of the user. | +| ``age`` | Number | false | The age of the user. | + +## Request example + +``` js +fetch('http://example.com/users/1', { + method: 'PUT', + body: JSON.stringify({ + name: 'John Doe', + age: 27, + }), + headers: { + 'Content-type': 'application/json', + }, +}) + .then((response) => response.json()) + .then((json) => console.log(json)); +``` + +## Response example + +``` JSON +{ + "id": 1, + "name": "John Doe", + "age": 27 +} +``` \ No newline at end of file diff --git a/tutorials/firstplugin.md b/documentation/docs/firstplugin.md similarity index 100% rename from tutorials/firstplugin.md rename to documentation/docs/firstplugin.md diff --git a/documentation/docs/get-started.md b/documentation/docs/get-started.md index 0b7b0319..e3ff2208 100644 --- a/documentation/docs/get-started.md +++ b/documentation/docs/get-started.md @@ -1,46 +1,13 @@ -# Get Started +# Getting started -This is a normal page, which contains VuePress basics. +- The classes starting with the prefix `Client` are client specific +- The classes starting with the prefix `Backend` are backend specific +- All the other classes are accessible from both sides -## Pages +If you want to use some view or partial of the Dragonroll source in your plugin, +you must do it from the "@" root. "@" represents the root of the `/src` directory of the client of Dragonroll, so for example, if you want to import the Dragonroll markdown +editor in your own views you should add: -You can add markdown files in your vuepress directory, every markdown file will be converted to a page in your site. - -See [routing][] for more details. - -## Content - -Every markdown file [will be rendered to HTML, then converted to a Vue SFC][content]. - -VuePress support basic markdown syntax and [some extensions][synatex-extensions], you can also [use Vue features][vue-feature] in it. - -## Configuration - -VuePress use a `.vuepress/config.js`(or .ts) file as [site configuration][config], you can use it to config your site. - -For [client side configuration][client-config], you can create `.vuepress/client.js`(or .ts). - -Meanwhile, you can also add configuration per page with [frontmatter][]. - -## Layouts and customization - -Here are common configuration controlling layout of `@vuepress/theme-default`: - -- [navbar][] -- [sidebar][] - -Check [default theme docs][default-theme] for full reference. - -You can [add extra style][style] with `.vuepress/styles/index.scss` file. - -[routing]: https://vuejs.press/guide/page.html#routing -[content]: https://vuejs.press/guide/page.html#content -[synatex-extensions]: https://vuejs.press/guide/markdown.html#syntax-extensions -[vue-feature]: https://vuejs.press/guide/markdown.html#using-vue-in-markdown -[config]: https://vuejs.press/guide/configuration.html#client-config-file -[client-config]: https://vuejs.press/guide/configuration.html#client-config-file -[frontmatter]: https://vuejs.press/guide/page.html#frontmatter -[navbar]: https://vuejs.press/reference/default-theme/config.html#navbar -[sidebar]: https://vuejs.press/reference/default-theme/config.html#sidebar -[default-theme]: https://vuejs.press/reference/default-theme/ -[style]: https://vuejs.press/reference/default-theme/styles.html#style-file +```js +import MarkdownEditor from '@/views/partials/MarkdownEditor.vue'; +``` \ No newline at end of file diff --git a/documentation/docs/server/test.md b/documentation/docs/server/test.md new file mode 100644 index 00000000..9022d488 --- /dev/null +++ b/documentation/docs/server/test.md @@ -0,0 +1 @@ +# Server test \ No newline at end of file diff --git a/tutorials/window.md b/documentation/docs/window.md similarity index 100% rename from tutorials/window.md rename to documentation/docs/window.md diff --git a/tutorials/guides.md b/tutorials/guides.md deleted file mode 100644 index e69de29b..00000000 diff --git a/tutorials/howtoread.md b/tutorials/howtoread.md deleted file mode 100644 index 68309c85..00000000 --- a/tutorials/howtoread.md +++ /dev/null @@ -1,3 +0,0 @@ -- The classes starting with the prefix `Client` are client specific -- The classes starting with the prefix `Backend` are backend specific -- All the other classes are accessible from both sides \ No newline at end of file diff --git a/tutorials/tutorials.json b/tutorials/tutorials.json deleted file mode 100644 index 092972ea..00000000 --- a/tutorials/tutorials.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "firstplugin": { - "title": "Creating your first plugin" - }, - "howtoread": { - "title": "How to read this documentation" - }, - "guides": { - "title": "Guides", - "children": { - "vdragonviews": { - "title": "Using Dragonroll views" - }, - "window": { - "title": "Creating a window" - } - } - } -} \ No newline at end of file diff --git a/tutorials/vdragonviews.md b/tutorials/vdragonviews.md deleted file mode 100644 index e811de1c..00000000 --- a/tutorials/vdragonviews.md +++ /dev/null @@ -1,7 +0,0 @@ -If you want to use some view or partial of the Dragonroll source in your plugin, -you must do it from the "@" root. "@" represents the root of the `/src` directory of the client of Dragonroll, so for example, if you want to import the Dragonroll markdown -editor in your own views you should add: - -```js -import MarkdownEditor from '@/views/partials/MarkdownEditor.vue'; -``` \ No newline at end of file