Skip to content

Show search notebook link in handbook and blog

Warren Gifford requested to merge jason-hackathon into main

Created by: jyavorska

This makes it so if you include a Sourcegraph notebook code fence in your markdown, it will add a link to the search page. For this iteration, it does not try to render a control to embed a working search on the page, just makes it so you can get to the search easily. Styling is absolutely minimal just to prove it works.

For example, using the following in markdown:

```sourcegraph
patterntype:structural repo:^github\.com/gitpod-io/openvscode-server$@5c8a1f file:^src/vs/code/browser/workbench/workbench\.ts create(document.body, {:[1]})

Will render as the following in the handbook:

image

Or as follows on the site:

image

Notes

  • There are sample pages at http://localhost:9000/blog/test/ and http://localhost:5082/handbook/product/test included in this PR
  • There is various test content that needs to be removed.
  • It required a change to github.com/sourcegraph/docsite to re-enable the wrapping pre, since otherwise no CSS classes indicating the language that was being rendered was available, and this required a minor CSS addition to ensure it rendered similarly to how it looks today. See https://github.com/jyavorska/sourcegraph for the fork, and layout.css for the handbook CSS adjustment. There's also an adjustment in the go.mod in this repo to replace the official docsite repo with my fork that needs to be removed if/when the main sourcegraph docsite repo is updated.
  • I don't know react and couldn't figure out the right place to put the Javascript for the main website so it would run. It's on the page for now, but that should be easily fixable. The handbook has it in the correct central location.
  • The script and CSS are copied in both the handbook and main website areas, even though they are exactly the same in the case of the Javascript, and could be made to be the same for the CSS. Not sure if there's an easy way to share it between them but if so that would be good.
  • No tests :)

Merge request reports

Loading