Module somedoc::model[][src]

Expand description

The document model here comprises a document type with nested blocks comprised of blocks and inline content.

The model contains the following structure.

  1. A Document which contains a list of BlockContent:
    1. Some block have no content of their own, such as BlockContent::ThematicBreak.
    2. Some block content is a basic type, such as BlockContent::Comment which contains a String.
    3. Some block content contains other block content, such as BlockContent::Quote.
    4. Most blocks contain a list of InlineContent.
      1. Some inline have no content of it’s own, such as InlineContent::LineBreak.
      2. Some inline content contains a basic type, such as InlineContent::Character which contains a char.
      3. Some inline content contains other inline content, such as InlineContent::Span.
      4. Most inline types contain a single structured type.
  2. A Document may also have associated metadata which may, or may not, be interpreted by a writer.

Re-exports

pub use document::Document;

Modules

block

This module is the root of a set of types that represent block content; that is, content that stands on it’s own such as a complete paragraph.

document

This module provides the root Document type and document metadata properties.

inline

This module is the root of a set of types that represent inline content; that is, content that does not stand on it’s own. In general the Text type is used to represent plain text, and the Span type is used to represent a styled group of inline content.

visitor

This module provides a set of traits for implementing model visitors as well as the function walk_document that walks a visitor over a specific Document.

Traits

HasInnerContent

This trait should be implemented by any type, whether block or inline, that includes. InlineContent. This allows for common treatment of such types in writers and similar use cases.

HasStyles

This trait should be implemented by any type, whether block or inline, that can be styled. The type parameter T denotes the style information to apply.

Style

A marker trait denoting that a type, most likely an enum, should be treated as a syle by the type HasStyles. All styles must support Default to denote the un-styled case.