Skip to main content

Module markdown

Module markdown 

Source
Expand description

Markdown rendering for gpuikit

This module provides markdown parsing and rendering using GPUI elements. It supports CommonMark and GitHub Flavored Markdown.

§Example

use gpuikit::markdown::{MarkdownStyle, markdown};
// Simple usage - create markdown element inline
div().child(markdown("# Hello\n\nThis is **bold** text.", cx))

// With custom style
div().child(
    markdown("# Hello", cx)
        .style(MarkdownStyle::new().code_font("Monaco"))
)

Structs§

InlinePalette
Theme-resolved colors for the inline styles that need them. Resolved by the element (which has the theme) and passed into RichText::to_highlights_with; None leaves that aspect unstyled.
InlineStyle
Inline text style flags that can be combined.
Markdown
A markdown document that can be rendered as a GPUI element.
MarkdownElement
Element for rendering markdown content.
MarkdownEvent
Parsed markdown event with source range information.
MarkdownSelection
Shared handle to a document’s selection state. Cheap to clone; every run element of one document holds the same handle.
MarkdownStyle
Complete style configuration for markdown rendering.
Options
Option struct containing flags for enabling extra features that are not part of the CommonMark spec.
Parser
Markdown event iterator.
RichText
Rich text container that holds styled text spans, plus the URL table that link spans index into.
SelectableText
A selectable (and optionally link-bearing) text run.
SelectionPosition
A position in the document: which run, and a byte offset into its text.
TextSpan
A span of text with associated styling.
TextStyle
Style configuration for a text element.

Enums§

CodeBlockKind
Codeblock kind.
CodeHighlightTheme
Which syntect theme code blocks highlight with.
HeadingLevel
Heading level (h1-h6).
LinkType
Type specifier for inline links. See the Tag::Link for more information.
RunRole
What kind of block a run is, and therefore how a screen reader announces it. Every run has one: a run that has not decided how it is announced cannot be built.

Constants§

BASE_SIZE
Base font size in rems.
DEFAULT_DARK_THEME
The syntect theme used on a dark surface when following the app.
DEFAULT_LIGHT_THEME
The syntect theme used on a light surface when following the app.
TYPESCALE_RATIO
The typescale ratio (minor third).

Functions§

block_quote
Render a block quote element with plain text.
code_block_language
Extract the language from a fenced code block kind.
code_highlight_themes
The syntect theme names CodeHighlightTheme::Pinned accepts, or an empty vector before init_code_highlighting.
default_options
Default parsing options with GFM support enabled.
divider
Render a horizontal rule (divider) element.
has_open_code_fence
Whether source ends with a fenced code block that never closed.
heading
Render a heading element with plain text.
image
Render an image element.
init_code_highlighting
Turn on syntax highlighting for markdown code blocks.
inline_code
Render inline code.
link
Render a link element.
list_item
Render a list item element with plain text.
markdown
Create a markdown element from source text.
normalize_language
Reduce a code fence’s info string to a language token, or None if it names no language.
ordered_marker
Get the marker for an ordered list item.
paragraph
Render a paragraph element with plain text.
parse
Parse markdown source with default options.
parse_with_options
Parse markdown source with custom options.
preprocessing_available
Whether this build can close open syntax — true with the stitch feature, false without it, where close_open_syntax is the identity.
set_code_highlight_theme
Pin code blocks to a specific syntect theme, or put them back on CodeHighlightTheme::FollowApp.
unordered_marker
Get the marker for an unordered list item.