Coder Social home page Coder Social logo

radames / observablehq-viewer Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 2.0 8.27 MB

Simple service to generate Observablehq notebooks previews outside Observablehq UI. It's also reproducing Observablehq UI styles

Home Page: https://observablehq-viewer.radamar.workers.dev

CSS 55.87% JavaScript 44.13%
observablehq viewer observable-notebook service server-side cloudflare-workers

observablehq-viewer's Introduction

ObservableHQ Viewer

This project makes it simple to preview an Observablehq notebook outside Observablehq UI.

Usage

  1. https://observablehq-viewer.radamar.workers.dev/USER/NOTEBOOK

  2. https://observablehq-viewer.radamar.workers.dev/USER/NOTEBOOK?cells=cellname1,cellname2

  3. https://observablehq-viewer.radamar.workers.dev/USER/NOTEBOOK?cells=cellname1,cellname2&fullwidth=1

Examples

from @fil/synchronized-projections

from @mbostock/voronoi-stippling

Named Cells

You can target only interesting cells and let code cells out of your preview. You will need named cells

cellName = {
  
}

Example

Take this https://observablehq.com/@johnburnmurdoch/bar-chart-race

Here you can preview only the cell names chart

or the whole notebook

https://observablehq-viewer.radamar.workers.dev/USER/NOTEBOOK?cells=cellname1,cellname2

or multiple cells

https://observablehq-viewer.radamar.workers.dev/@radames/hello-d3fc-webgl?cells=title,chartEl

Full Width

Pass fullwidth=1 param to render the cells on 100% of viewport, disabling max-width: 64rem that Observablehq UI defaults.

Example

or the whole notebook

TODOS

  • link back to original notebook on Observablehq
  • notebook author information on preview
  • change page title to notebook title (fetch title from observablehq api)

observablehq-viewer's People

Contributors

fil avatar radames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

observablehq-viewer's Issues

php version & page width

Excellent! I have a hacky PHP script that does something similar (code below for reference). Maybe I should try and converge it to the same API as yours (e.g. url, cells selection, css…).

I'm noticing a difference in the width of the page, where your version has .mw8 { max-width: 64rem; }, and mine doesn't add limitations. In the case of a certain notebook I want to use the full page width. It can be done from within the notebook by adding a style cell with html<style>main.mw8 { max-width: 100vw }. Maybe that's an option worth documenting (with other interesting possibilities, such as alignment).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.