Files
paseo/packages/react-native-enriched-markdown/ios/utils/MarkdownASTSerializer.h
T
1ff119dc2a feat(app): copy a quote's body with one tap (#10608)
Agents often write drafts as quotes meant to be pasted elsewhere. A plain
quote now has a copy control on web, desktop, Android and iOS. It copies
the quote's body without the `>` markers and with its nested Markdown. A
nested quote, a code block or a Mermaid diagram inside it keeps its own
control. Admonitions get no control.

Web reads the rendered quote at press time, so a streaming quote copies
what it shows, and writes the same two clipboard flavors as selection
copy. A rendered Mermaid diagram copies as the fence it shows, and an
admonition inside a copied quote copies as its `> [!TYPE]` source. Code
blocks and quotes share one copy button with a Copied state and an error
toast when the clipboard refuses the write. On compact layouts the
control is always visible in a band above the quote body. On wide
layouts it shows on hover or focus and the quote keeps a right gutter.

Native code blocks and quotes share one header copy control with the
Lucide Copy glyph. A quote reserves the code block's header band above
its body, so the control never covers text at any font size. Native copy
emits the quote body as written, and a copied fence grows longer than
any fence inside its code.

Supersedes #9429 and #9319. Refs discussion #9303.

Co-authored-by: Pedro Vieira <pedro.vieira@dremio.com>
Co-authored-by: Phieu Dinh <phieu@fiu.one>
2026-11-25 13:36:01 +07:00

36 lines
1.2 KiB
Objective-C

#pragma once
#import <Foundation/Foundation.h>
@class MarkdownASTNode;
NS_ASSUME_NONNULL_BEGIN
#ifdef __cplusplus
extern "C" {
#endif
/// Serializes an AST node (and its children) back to markdown syntax.
/// Handles inline elements: strong, emphasis, strikethrough, underline, code, links, images.
NSString *markdownFromASTNode(MarkdownASTNode *node);
/// Serializes only the children of a node to markdown (skipping the node itself).
/// Useful for extracting the markdown content of a container node (e.g. a table cell).
NSString *markdownFromASTNodeChildren(MarkdownASTNode *node);
/// Serializes the blocks inside a Blockquote to markdown, without the quote's own
/// `> ` prefix. A quote nested inside keeps its prefix.
NSString *markdownFromBlockquoteBody(MarkdownASTNode *node);
/// Serializes a Blockquote or Admonition node to full markdown, including `> ` line
/// prefixes and `> [!TYPE]` header for admonitions.
NSString *markdownFromBlockquoteNode(MarkdownASTNode *node);
/// Extracts plain text content from an AST node recursively (no markdown syntax).
NSString *plainTextFromASTNode(MarkdownASTNode *node);
#ifdef __cplusplus
}
#endif
NS_ASSUME_NONNULL_END