Improve documentation support with markdown
Rework documentation URLs as inline markdown. Redesign documentations with markdown text. Redesign way to document scripts/categories and present the documentation. Documentation is showed in an expandable box instead of tooltip. This is to allow writing longer documentation (tooltips are meant to be used for short text) and have better experience on mobile. If a node (script/category) has documentation it's now shown with single information icon (ℹ) aligned to right. Add support for rendering documentation as markdown. It automatically converts plain URLs to URLs with display names (e.g. https://docs.microsoft.com/..) will be rendered automatically like "docs.microsoft.com - Windows 11 Privacy...".
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { CategoryData, CategoryOrScriptData, DocumentationUrlsData } from '@/application/collections/';
|
||||
import type { CategoryData, CategoryOrScriptData, DocumentationData } from '@/application/collections/';
|
||||
import { ScriptDataStub } from './ScriptDataStub';
|
||||
|
||||
export class CategoryDataStub implements CategoryData {
|
||||
@@ -6,7 +6,7 @@ export class CategoryDataStub implements CategoryData {
|
||||
|
||||
public category = 'category name';
|
||||
|
||||
public docs?: DocumentationUrlsData;
|
||||
public docs?: DocumentationData;
|
||||
|
||||
public withChildren(children: readonly CategoryOrScriptData[]) {
|
||||
this.children = children;
|
||||
@@ -18,7 +18,7 @@ export class CategoryDataStub implements CategoryData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public withDocs(docs: DocumentationUrlsData) {
|
||||
public withDocs(docs: DocumentationData) {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export class CategoryStub extends BaseEntity<number> implements ICategory {
|
||||
|
||||
public readonly scripts = new Array<IScript>();
|
||||
|
||||
public readonly documentationUrls = new Array<string>();
|
||||
public readonly docs = new Array<string>();
|
||||
|
||||
public constructor(id: number) {
|
||||
super(id);
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ScriptDataStub implements ScriptData {
|
||||
|
||||
public recommend = RecommendationLevel[RecommendationLevel.Standard].toLowerCase();
|
||||
|
||||
public docs = ['hello.com'];
|
||||
public docs?: readonly string[] = ['hello.com'];
|
||||
|
||||
private constructor() { /* use static methods for constructing */ }
|
||||
|
||||
@@ -42,7 +42,7 @@ export class ScriptDataStub implements ScriptData {
|
||||
return this;
|
||||
}
|
||||
|
||||
public withDocs(docs: string[]): ScriptDataStub {
|
||||
public withDocs(docs: readonly string[]): ScriptDataStub {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export class ScriptStub extends BaseEntity<string> implements IScript {
|
||||
revert: `REM revert-code (${this.id})`,
|
||||
};
|
||||
|
||||
public readonly documentationUrls = new Array<string>();
|
||||
public readonly docs = new Array<string>();
|
||||
|
||||
public level? = RecommendationLevel.Standard;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user