Download src/docs/doc_viewer.hpp from thevareoz/astra-browser-core: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/thevareoz/astra-browser-core/resolve/main/src/docs/doc_viewer.hpp
- Command line
-
hf download hf://thevareoz/astra-browser-core/src/docs/doc_viewer.hpp
-
curl -L -o doc_viewer.hpp https://huggingface.co/thevareoz/astra-browser-core/resolve/main/src/docs/doc_viewer.hpp
1.17 kB
| namespace astra { | |
| struct ParsedDocument { | |
| std::string format; // "PDF", "Markdown", "Text" | |
| std::string title; | |
| std::string author; | |
| std::string pdf_version; | |
| size_t page_count = 0; | |
| std::vector<std::string> pages; | |
| bool ok = false; | |
| std::string error; | |
| }; | |
| // AstraDocs: Zero-dependency native PDF, Markdown, and plaintext/code viewer. | |
| // Parses real PDF objects, FlateDecode streams, and BT/ET/Tj/TJ text operators | |
| // directly in C++20 without pdf.js or third-party PDF libraries. | |
| class DocViewer { | |
| public: | |
| static ParsedDocument parse_pdf_file(const std::string& path); | |
| static ParsedDocument parse_pdf_bytes(std::string_view bytes, const std::string& fallback_title = "Document.pdf"); | |
| static ParsedDocument parse_markdown_file(const std::string& path); | |
| static ParsedDocument parse_markdown(std::string_view md, const std::string& fallback_title = "Document.md"); | |
| // Compiles any ParsedDocument into clean Astra HTML for native layout & rendering. | |
| static std::string to_astra_html(const ParsedDocument& doc); | |
| }; | |
| } // namespace astra | |