mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 02:05:31 +00:00
Copy react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67 (upstream software-mansion/enriched-markdown 766fc0e67) into packages/react-native-enriched-markdown, with patches/react-native-enriched-markdown+1.2.0-nightly-20261014-766fc0e67.patch applied. Nothing else changes in this commit; the package is not a workspace yet. Reproduce: npm pack react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67 tar xzf react-native-enriched-markdown-*.tgz mkdir -p t/node_modules && mv package t/node_modules/react-native-enriched-markdown (cd t && git init -q && git apply ../patches/react-native-enriched-markdown+*.patch) diff -r t/node_modules/react-native-enriched-markdown packages/react-native-enriched-markdown The diff is empty.
29 lines
842 B
C++
29 lines
842 B
C++
#pragma once
|
|
|
|
#include "MarkdownASTNode.hpp"
|
|
#include <cstddef>
|
|
#include <functional>
|
|
#include <cstdint>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace Markdown {
|
|
|
|
// Offsets are UTF-16 code units, as every host regex engine reports them.
|
|
struct TextRange {
|
|
size_t start;
|
|
size_t end;
|
|
};
|
|
|
|
// Host-provided matching, one call per kind per parse. A null function is off.
|
|
struct TextLinkMatchers {
|
|
// Non-overlapping matches per run, in order.
|
|
std::function<std::vector<std::vector<TextRange>>(const std::vector<std::string_view>& runs)> text;
|
|
std::function<std::vector<uint8_t>(const std::vector<std::string_view>& spans)> inlineCode;
|
|
};
|
|
|
|
// In place. Existing links, code blocks, media and math are not entered.
|
|
void recognizeTextLinks(MarkdownASTNode& root, const TextLinkMatchers& matchers);
|
|
|
|
} // namespace Markdown
|