Skip to content

data.markdownrenderer #

Markdown Renderer Module

This module provides functionality for rendering Markdown content in various formats.

Features

  • Supports multiple rendering formats (e.g., HTML, plain text, structure)
  • Utilizes the V language Markdown parser
  • Customizable rendering options

Usage

import freeflowuniverse.herolib.data.markdownrenderer

// Example usage
md_text := '# Hello World\n\nThis is a paragraph.'
html_output := markdownrenderer.to_html(md_text)
plain_output := markdownrenderer.to_plain(md_text)
structure_output := markdownrenderer.to_structure(md_text)

Dependencies

This module depends on the V language Markdown parser: https://github.com/vlang/markdown/tree/master

For more detailed information, refer to the individual renderer implementations in this module.

fn to_structure #

fn to_structure(input string) string

to_structure renders a markdown string and returns its structure

struct StructureRenderer #

struct StructureRenderer {
mut:
	writer strings.Builder = strings.new_builder(200)
	indent int // Track indentation level for nested elements
}

StructureRenderer is a custom renderer that outputs the structure of a markdown document

fn (StructureRenderer) str #

fn (mut sr StructureRenderer) str() string