This repository has been archived by the owner on Oct 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Visitor
mattt edited this page Jan 14, 2021
·
1 revision
Visitor for walking a visitable structure.
public protocol Visitor
Override the appropriate func visit(…:)
's return value
to customize the behavior (e.g. skip a given element's children),
with sub-types overriding their super-type's behavior.
The default implementation of func visit(…:)
returns .inherit
,
resulting in a deep walk over the entire document.
Node
├── Block
│ ├── ContainerBlock
│ │ ├── BlockQuote
│ │ ├── List
│ │ └── List.Item
│ │
│ └── LeafBlock
│ ├── CodeBlock
│ ├── HTMLBlock
│ ├── Heading
│ ├── Paragraph
│ └── ThematicBreak
│
└── Inline
├── Code
├── Emphasis
├── HardLineBreak
├── Image
├── Link
├── RawHTML
├── SoftLineBreak
├── Strong
└── Text
The order of object-wise visitations is: super-type before sub-type.
The order of object-wise visitations is: sub-type before super-type.
Walks a visitable structure.
func walk<T: Visitable>(_ visitable: T)
- visitable: The structure to walk.
func visit(document: Document) -> VisitorContinueKind
func visitPost(document: Document)
func visit(node: Node) -> VisitorContinueKind
func visitPost(node: Node)
func visit(block: Block) -> VisitorContinueKind
func visitPost(block: Block)
func visit(containerBlock: ContainerBlock) -> VisitorContinueKind
func visitPost(containerBlock: ContainerBlock)
func visit(blockQuote: BlockQuote) -> VisitorContinueKind
func visitPost(blockQuote: BlockQuote)
func visit(list: List) -> VisitorContinueKind
func visitPost(list: List)
func visit(listItem: List.Item) -> VisitorContinueKind
func visitPost(listItem: List.Item)
A block that can only contain inline elements.
func visit(leafBlock: LeafBlock) -> VisitorContinueKind
func visitPost(leafBlock: LeafBlock)
func visit(heading: Heading) -> VisitorContinueKind
func visitPost(heading: Heading)
func visit(paragraph: Paragraph) -> VisitorContinueKind
func visitPost(paragraph: Paragraph)
func visit(htmlBlock: HTMLBlock) -> VisitorContinueKind
func visitPost(htmlBlock: HTMLBlock)
func visit(codeBlock: CodeBlock) -> VisitorContinueKind
func visitPost(codeBlock: CodeBlock)
func visit(thematicBreak: ThematicBreak) -> VisitorContinueKind
func visitPost(thematicBreak: ThematicBreak)
func visit(inline: Inline) -> VisitorContinueKind
func visitPost(inline: Inline)
func visit(text: Text) -> VisitorContinueKind
func visitPost(text: Text)
func visit(strong: Strong) -> VisitorContinueKind
func visitPost(strong: Strong)
func visit(emphasis: Emphasis) -> VisitorContinueKind
func visitPost(emphasis: Emphasis)
func visit(link: Link) -> VisitorContinueKind
func visitPost(link: Link)
func visit(image: Image) -> VisitorContinueKind
func visitPost(image: Image)
func visit(code: Code) -> VisitorContinueKind
func visitPost(code: Code)
func visit(rawHTML: RawHTML) -> VisitorContinueKind
func visitPost(rawHTML: RawHTML)
func visit(softLineBreak: SoftLineBreak) -> VisitorContinueKind
func visitPost(softLineBreak: SoftLineBreak)
func visit(hardLineBreak: HardLineBreak) -> VisitorContinueKind
func visitPost(hardLineBreak: HardLineBreak)
Generated at 2021-03-03T19:19:22+0000 using swift-doc 1.0.0-beta.5.
Types
- BlockQuote
- Code
- CodeBlock
- CommonMarkBuilder
- Document
- Document.Error
- Document.ParsingOptions
- Document.Position
- Emphasis
- ForEach
- Fragment
- HTMLBlock
- HardLineBreak
- Heading
- Image
- Link
- List
- List.Delimiter
- List.Item
- List.Kind
- Node
- Node.RenderingFormat
- Node.RenderingOptions
- Paragraph
- RawHTML
- Section
- SoftLineBreak
- StringBuilder
- Strong
- Text
- ThematicBreak
- VisitorContinueKind