Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

modethirteen/backstage-plugin-techdocs-addon-sourcegraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backstage TechDocs Addon for Sourcegraph

npm version

A module that extends Sourcegraph capabilities into Backstage TechDocs.

Getting started

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>

Further resources