Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TechDocs Addon for Mermaid #630

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ site

# E2E test reports
e2e-test-report/

# Local TechDocs
packages/backend/techdocs/**
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip3 install mkdocs-techdocs-core markdown-inline-mermaid

RUN yarn global add @mermaid-js/mermaid-cli
RUN pip3 install mkdocs-techdocs-core

RUN curl -o plantuml.jar -L https://github.com/plantuml/plantuml/releases/download/v1.2023.10/plantuml-1.2023.10.jar && echo "527d28af080ae91a455e7023e1a726c7714dc98e plantuml.jar" | sha1sum -c - && mv plantuml.jar /opt/plantuml.jar
RUN echo '#!/bin/sh\n\njava -jar '/opt/plantuml.jar' ${@}' >> /usr/local/bin/plantuml
Expand Down
3 changes: 2 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/jest-dom",
"webpack-env",
"lint-staged",
"@types/lodash"
"@types/lodash",
"@types/d3"
]
}
3 changes: 0 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ site_name: 'Backstage Demo'

plugins:
- techdocs-core

markdown_extensions:
- markdown_inline_mermaid
4 changes: 4 additions & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
"@backstage/plugin-search-react": "^1.8.1-next.2",
"@backstage/plugin-signals": "^0.0.11-next.2",
"@backstage/plugin-techdocs": "^1.11.0-next.2",
"@backstage/plugin-techdocs-module-addons-contrib": "^1.1.16-next.2",
"@backstage/plugin-techdocs-react": "^1.2.9-next.2",
"@backstage/plugin-user-settings": "^0.8.14-next.2",
"@backstage/theme": "^0.6.0-next.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"backstage-plugin-techdocs-addon-mermaid": "^0.13.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.3.0",
Expand All @@ -47,6 +50,7 @@
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^16.0.0",
"@types/d3": "^7.4.3",
"@types/node": "^20.0.0",
"@types/react-dom": "*",
"@types/uuid": "^10.0.0",
Expand Down
19 changes: 18 additions & 1 deletion packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ import { HomePage } from './components/home/HomePage';
import { CustomizableHomePage } from './components/home/CustomizableHomePage';
import { ScaffolderPage, scaffolderPlugin } from '@backstage/plugin-scaffolder';
import { NotificationsPage } from '@backstage/plugin-notifications';
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import {
ExpandableNavigation,
LightBox,
ReportIssue,
TextSize,
} from '@backstage/plugin-techdocs-module-addons-contrib';
import { Mermaid } from 'backstage-plugin-techdocs-addon-mermaid';
import { SignalsDisplay } from '@backstage/plugin-signals';

const app = createApp({
Expand Down Expand Up @@ -146,7 +154,16 @@ const routes = (
<Route
path="/docs/:namespace/:kind/:name/*"
element={<TechDocsReaderPage />}
/>
>
<TechDocsAddons>
<ExpandableNavigation />
<LightBox />
<ReportIssue />
<TextSize />
<Mermaid />
</TechDocsAddons>
</Route>
;
<Route path="/explore" element={<ExplorePage />} />
<Route path="/graphiql" element={<GraphiQLPage />} />
<Route path="/search" element={<SearchPage />}>
Expand Down
26 changes: 23 additions & 3 deletions packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ import {
EntityKubernetesContent,
isKubernetesAvailable,
} from '@backstage/plugin-kubernetes';
import {
ExpandableNavigation,
LightBox,
ReportIssue,
TextSize,
} from '@backstage/plugin-techdocs-module-addons-contrib';
import { TechDocsAddons } from '@backstage/plugin-techdocs-react';
import { Mermaid } from 'backstage-plugin-techdocs-addon-mermaid';

const EntityLayoutWrapper = (props: { children?: React.ReactNode }) => {
const [badgesDialogOpen, setBadgesDialogOpen] = useState(false);
Expand Down Expand Up @@ -154,6 +162,18 @@ const cicdCard = (
</EntitySwitch>
);

const techdocsContentWithAddons = (
<EntityTechdocsContent>
<TechDocsAddons>
<ExpandableNavigation />
<LightBox />
<ReportIssue />
<TextSize />
<Mermaid />
</TechDocsAddons>
</EntityTechdocsContent>
);

const overviewContent = (
<Grid container spacing={3} alignItems="stretch">
{entityWarningContent}
Expand Down Expand Up @@ -218,7 +238,7 @@ const serviceEntityPage = (
</EntityLayout.Route>

<EntityLayout.Route path="/docs" title="Docs">
<EntityTechdocsContent />
{techdocsContentWithAddons}
</EntityLayout.Route>

<EntityLayout.Route path="/todos" title="TODOs">
Expand Down Expand Up @@ -257,7 +277,7 @@ const websiteEntityPage = (
</EntityLayout.Route>

<EntityLayout.Route path="/docs" title="Docs">
<EntityTechdocsContent />
{techdocsContentWithAddons}
</EntityLayout.Route>

<EntityLayout.Route path="/todos" title="TODOs">
Expand All @@ -273,7 +293,7 @@ const defaultEntityPage = (
</EntityLayout.Route>

<EntityLayout.Route path="/docs" title="Docs">
<EntityTechdocsContent />
{techdocsContentWithAddons}
</EntityLayout.Route>

<EntityLayout.Route path="/todos" title="TODOs">
Expand Down
Loading