A module that extends Sourcegraph capabilities into Backstage TechDocs.
This module is a Backstage TechDocs Addon plugin, which requires Backstage v1.2+. The plugin provides a component for embedding Sourcegraph Notebooks. Follow the official documentation for TechDocs Addons to use this addon.
import { SourcegraphNotebook } from 'backstage-plugin-techdocs-addon-sourcegraph';
// Sourcegraph instance domain (Required)
const domain = 'sourcegraph.example.com';
// pre-render callback (Optional)
const callback = ({
// div wrapper for embedded Notebook
container: HTMLDivElement,
// embedded notebook iframe
iframe: HTMLIFrameElement,
// notebook id
id: string,
// non-embedded notebook url
url: string
}) => {
// ...some extra handling or DOM manipulation before attaching the
// iframe to the container
container.append(iframe);
});
<TechDocsAddons>
<SourcegraphNotebook domain={domain} callback={callback} />
</TechDocsAddons>