Home Docs Workflow guides

Embed a code excerpt

Iframe-friendly snippets
Workflow

Embed a code excerpt

Render a plaintext paste or line range in an embeddable HTML surface with theme and line-number controls.

When to use it

Use this when

  • A blog post, issue, or internal doc needs a live paste excerpt.
  • The content is plaintext and safe to render in another page.
Steps

Do this

  1. Create a plaintext paste Embed refuses encrypted pastes; use the full viewer for client-managed decryption.
  2. Select a bounded range Pass lines=10-40 to focus the embed. The route validates ranges and caps very large excerpts.
  3. Set display options Use theme=system, light, or dark and linenumbers=0 when surrounding prose already names the lines.
Examples

Copyable commands

Iframe
<iframe
  src="https://pastebin.ca/2EREFnGBXq/embed?lines=10-40&theme=dark"
  title="Configuration excerpt"
  loading="lazy"
  style="width:100%;min-height:360px;border:0"
></iframe>
No line numbers
https://pastebin.ca/2EREFnGBXq/embed?lines=1-20&theme=system&linenumbers=0
Operational notes

Keep in mind

  • Signed-url pastes require the same ?s= token on the embed URL.
  • Use raw URLs for machine reads; embed is meant for human-readable HTML.