Skip to main content

Module plain_text_post

Module plain_text_post 

Source
Expand description

§Plain-text → hashiverse HTML conversion

Hashiverse posts are stored and transmitted as a constrained subset of HTML (so that rich posts from the web client, API clients, and plain-text API clients are all the same format on the wire). This module provides the one-way convenience path for callers that have nothing but a string of text — mainly the Python client, plain-text API integrations, and quick CLI posts.

The output is the same HTML shape produced by the Tiptap editor in the web client: HTML-escaped body, #hashtag tokens rewritten as <hashtag> elements, @<64-hex-id> mentions rewritten as <mention> elements, and literal newlines turned into <br>. submit_post() then parses the result into the canonical on-wire representation.

Functions§

convert_text_to_hashiverse_html
Converts a plain-text post into well-formed HTML that submit_post() can parse.
convert_text_to_hashiverse_html_x_hashtag
Render a hashtag as the canonical hashiverse element.
convert_text_to_hashiverse_html_x_mention
Render a 64-hex client_id as a <mention> element. Caller is responsible for validating the hex length; we accept any string.
convert_text_to_hashiverse_html_x_url_preview
Render the canonical URL preview card. Same shape as the web client’s build_card_dom (hashiverse-client-web/src/tabs/compose/UrlPreviewExtension.ts):