Skip to content

brudil/spectrum-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Spectrum Format Specification

Specification for the Spectrum content format.

Version: 0.1

Table of Contents generated with DocToc

Overview

Format

Document/root

The top level of Spectrum.

Fields:

  • version: Number, version of spectrum spec document is using. Used for spectrum migrations
  • content: Subtype, document content
{
  "version": 0.1
  "content": SubtypeOutput
}

Subtypes

Subtypes define the shape of the content. For example, an Article subtype might have a stream of blocks. Where as a Video subtype could also have a video block at its root level. A gallery subtype could deviate from the loose stream of blocks entirely to have a more structured stream of Image blocks.

Fields:

  • _name: String, name of the subtype
  • []: Properties, properties that define the subtype

Article subtype

Fields:

  • name: 'article'
  • stream: Stream of sections

Video subtype

Fields:

  • name: 'video'
  • featureVideo: VideoBlock
  • stream: Stream of sections

Sections 📝

Freeform 📝

List 📝

Streams 📝

Blocks

Blocks are the containers of different types of media elements, for example videos, text, quotes, images and embeds.

Image block

Fields:

  • name: 'image'
  • reference: ImageResource
  • alt: PlainTextTransformer
  • title: PlainTextTransformer
  • caption: InlinedownTextTransformer
  • source: InlinedownTextTransformer
  • sourceURL: String(validation=URL)

Video block

Fields:

  • name: 'video'
  • reference: VideoResource
  • caption: InlinedownTextTransformer
  • source: InlinedownTextTransformer
  • sourceURL: String(validation=URL)

Heading block

Fields:

  • name: 'heading'
  • level: Number(min=1, max=6)
  • text: InlinedownTextTransformer

Text Block

Fields:

  • name: 'text'
  • text: MarkdownTextTransformer

Quote block

  • name: 'quote'
  • quote: InlinedownTextTransformer
  • attributed: InlinedownTextTransformer

Text Transformers

Transformers have a common output: HTML.

  • name: 'transformer'
  • transformer: name of transformer
  • text: string
Markdown
  • name: 'markdown'

Transforms Markdown text.

Inlinedown
  • name: 'inline'

Transforms inline-level Markdown text. This essentially limits generated elements to anchors, emphasis and strong tags.

Plaintext
  • name: 'plain'

No transform.

HTML safe
  • name: 'html'

No transform. HTML directly injected. Does not escape.

Implementation concepts

Fields 📝

About

Specification for the Spectrum content format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published