feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Preconfigured cells for embeds

Open CobusT opened this issue 3 years ago • 0 comments

This is from aaronkyle in Slack.

Is your feature request related to a problem? Please describe. I have some long, crufty notebooks wherein 20% of the content is what I want to show, and always selecting this 20% is a bit unmanageable (since it's still several dozen cells)

Describe the solution you'd like Would it be possible to identify a range of cells that I can pin by default for a notebook embed view? I.e. such that I could make it that if I were to name these cells, any time that i reference the embed, I would get only this group?

Describe alternatives you've considered I can use a function and add a link like this to each notebook where I need this, but I don't necessarily want to have this on the notebook...

function embedView (cells=[], text="Embedded notebook view") {
  const embedUrl = document.baseURI.replace(/observablehq.com/, "observablehq.com/embed");
  const paramChar = document.baseURI.includes("?") ? "&" : "?";
  const cellsText = cells.length>0 ? paramChar + "cells="+cells.reduce((a,c)=>a+"%2C"+c) : "";
  return md`[${text}](${embedUrl+cellsText})`
}

Additional context Add any other context or screenshots about the feature request here.

CobusT avatar Mar 19 '21 15:03 CobusT