-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from awanlin/topic/techdocs-example
Added TechDocs examples and related changes
- Loading branch information
Showing
15 changed files
with
242 additions
and
15 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,25 @@ | ||
# iframe | ||
|
||
## Overview | ||
|
||
This page shows how you can use an iframe in TechDocs. | ||
|
||
## Explanation | ||
|
||
To be able to use iframes with TechDocs you'll need to follow this guide: [How to enable iframes in TechDocs](https://backstage.io/docs/features/techdocs/how-to-guides#how-to-enable-iframes-in-techdocs) | ||
|
||
## Example | ||
|
||
Here is an example: | ||
|
||
<iframe width="672" height="378" src="https://www.youtube.com/embed/85TQEpNCaU0" title="YouTube video player" frameborder="0" allow="picture-in-picture" allowfullscreen></iframe> | ||
|
||
## Markdown | ||
|
||
Here is the Markdown: | ||
|
||
```markdown | ||
<iframe width="672" height="378" frameborder="0" | ||
src="https://www.youtube.com/embed/85TQEpNCaU0" title="YouTube video player" | ||
allow="picture-in-picture" allowfullscreen></iframe> | ||
``` |
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,37 @@ | ||
# Lists | ||
|
||
## Overview | ||
|
||
This page shows how you can use lists in TechDocs. | ||
|
||
## Explanation | ||
|
||
The [`techdocs-core`](https://github.com/backstage/mkdocs-techdocs-core) MkDocs plugin includes the [`mdx_truly_sane_lists`](https://github.com/radude/mdx_truly_sane_lists) plugin which has a default of 2, this means that each nested list needs to be 2 spaces under its parent. | ||
|
||
## Example | ||
|
||
Here is an example: | ||
|
||
1. A list item | ||
2. Another list item | ||
1. The first sub item | ||
2. Another sub item | ||
1. Oh wait, we have a deeply nested item here | ||
2. Why not another, you might need it! | ||
3. A third and final sub item | ||
3. The last item in this list | ||
|
||
## Markdown | ||
|
||
Here is the Markdown: | ||
|
||
```markdown | ||
1. A list item | ||
2. Another list item | ||
1. The first sub item | ||
2. Another sub item | ||
1. Oh wait, we have a deeply nested item here | ||
2. Why not another, you might need it! | ||
3. A third and final sub item | ||
3. The last item in this list | ||
``` |
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,36 @@ | ||
# Mermaid | ||
|
||
## Overview | ||
|
||
This page shows how you can use [Mermaid](https://mermaid.js.org/intro/) in TechDocs. | ||
|
||
## Explanation | ||
|
||
To be able to use Mermaid diagrams with TechDocs you'll need to follow this guide: [How to add Mermaid support in TechDocs](https://backstage.io/docs/features/techdocs/how-to-guides#how-to-add-mermaid-support-in-techdocs). | ||
|
||
## Example | ||
|
||
Here is an example: | ||
|
||
```kroki-mermaid | ||
sequenceDiagram | ||
Alice->>John: Hello John, how are you? | ||
John-->>Alice: Great! | ||
Alice-)John: See you later! | ||
``` | ||
|
||
>Note: For this example we are using [Kroki.io](https://kroki.io/), but you may which to run your own server to protect TechDocs with sensitive content. More details on this topic are in the previously linked guide. | ||
## Markdown | ||
|
||
Here is the Markdown: | ||
|
||
```markdown | ||
kroki-mermaid | ||
sequenceDiagram | ||
Alice->>John: Hello John, how are you? | ||
John-->>Alice: Great! | ||
Alice-)John: See you later! | ||
``` | ||
|
||
>Note: in order to prevent Mermaid from rendering the diagram above the backticks (\`) have been removed. You'll want to add 3 backticks on line 1 before `kroki-mermaid` and then another 3 backticks on a new line below line 5. |
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,38 @@ | ||
# PlantUML | ||
|
||
## Overview | ||
|
||
This page shows how you can use [PlantUML](https://plantuml.com/) in TechDocs. | ||
|
||
## Explanation | ||
|
||
The [`techdocs-core`](https://github.com/backstage/mkdocs-techdocs-core) MkDocs plugin includes the [`plantuml-markdown`](https://github.com/mikitex70/plantuml-markdown) plugin which allows you to add PlantUML diagrams in your Markdown easily. | ||
|
||
## Example | ||
|
||
Here is an example: | ||
|
||
```plantuml | ||
@startuml | ||
title Login Sequence | ||
ComponentA->ComponentB: Login Request | ||
note right of ComponentB: ComponentB logs message | ||
ComponentB->ComponentA: Login Response | ||
@enduml | ||
``` | ||
|
||
## Markdown | ||
|
||
Here is the Markdown: | ||
|
||
```markdown | ||
plantuml | ||
@startuml | ||
title Login Sequence | ||
ComponentA->ComponentB: Login Request | ||
note right of ComponentB: ComponentB logs message | ||
ComponentB->ComponentA: Login Response | ||
@enduml | ||
``` | ||
|
||
>Note: in order to prevent PlantUML from rendering the diagram above the backticks (\`) have been removed. You'll want to add 3 backticks on line 1 before `plantuml` and then another 3 backticks on a new line below line 7. |
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,14 @@ | ||
# TechDocs | ||
|
||
## Overview | ||
|
||
This set of documentation is intended to show simple working examples of TechDocs. | ||
|
||
## Examples | ||
|
||
Current examples: | ||
|
||
- [iframe](./examples/iframe.md): this shows how you can use an iframe in your TechDocs | ||
- [Lists](./examples/lists.md): this showcases how to setup your lists in TechDocs | ||
- [Mermaid](./examples/mermaid.md): this showcases how to use Mermaid diagrams in your TechDocs | ||
- [PlantUML](./examples/plantuml.md): this showcases how to use PlantUML diagrams in your TechDocs |
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,5 @@ | ||
site_name: 'Backstage Demo' | ||
|
||
plugins: | ||
- techdocs-core | ||
- kroki |
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,25 @@ | ||
import { createBackendModule } from '@backstage/backend-plugin-api'; | ||
import { | ||
DocsBuildStrategy, | ||
techdocsBuildsExtensionPoint, | ||
} from '@backstage/plugin-techdocs-node'; | ||
|
||
export default createBackendModule({ | ||
pluginId: 'techdocs', | ||
moduleId: 'customBuildStrategy', | ||
register(env) { | ||
env.registerInit({ | ||
deps: { | ||
techdocs: techdocsBuildsExtensionPoint, | ||
}, | ||
async init({ techdocs }) { | ||
const docsBuildStrategy: DocsBuildStrategy = { | ||
shouldBuild: async params => | ||
params.entity.metadata?.annotations?.['demo.backstage.io/techdocs-builder'] === 'local', | ||
}; | ||
|
||
techdocs.setBuildStrategy(docsBuildStrategy); | ||
}, | ||
}); | ||
}, | ||
}); |
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