kreuzberg 4.0.0.pre.rc.29 → 4.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -6
- data/.rubocop.yaml +534 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +28 -116
- data/README.md +269 -629
- data/Rakefile +0 -9
- data/Steepfile +4 -8
- data/examples/async_patterns.rb +58 -1
- data/ext/kreuzberg_rb/extconf.rb +5 -35
- data/ext/kreuzberg_rb/native/Cargo.toml +16 -55
- data/ext/kreuzberg_rb/native/build.rs +14 -12
- data/ext/kreuzberg_rb/native/include/ieeefp.h +1 -1
- data/ext/kreuzberg_rb/native/include/msvc_compat/strings.h +1 -1
- data/ext/kreuzberg_rb/native/include/strings.h +2 -2
- data/ext/kreuzberg_rb/native/include/unistd.h +1 -1
- data/ext/kreuzberg_rb/native/src/lib.rs +34 -897
- data/extconf.rb +6 -38
- data/kreuzberg.gemspec +20 -114
- data/lib/kreuzberg/api_proxy.rb +18 -2
- data/lib/kreuzberg/cache_api.rb +0 -22
- data/lib/kreuzberg/cli.rb +10 -2
- data/lib/kreuzberg/cli_proxy.rb +10 -0
- data/lib/kreuzberg/config.rb +22 -274
- data/lib/kreuzberg/errors.rb +7 -73
- data/lib/kreuzberg/extraction_api.rb +8 -237
- data/lib/kreuzberg/mcp_proxy.rb +11 -2
- data/lib/kreuzberg/ocr_backend_protocol.rb +73 -0
- data/lib/kreuzberg/post_processor_protocol.rb +71 -0
- data/lib/kreuzberg/result.rb +33 -151
- data/lib/kreuzberg/setup_lib_path.rb +2 -22
- data/lib/kreuzberg/validator_protocol.rb +73 -0
- data/lib/kreuzberg/version.rb +1 -1
- data/lib/kreuzberg.rb +13 -27
- data/pkg/kreuzberg-4.0.0.rc1.gem +0 -0
- data/sig/kreuzberg.rbs +12 -105
- data/spec/binding/cache_spec.rb +22 -22
- data/spec/binding/cli_proxy_spec.rb +4 -2
- data/spec/binding/cli_spec.rb +11 -12
- data/spec/binding/config_spec.rb +0 -74
- data/spec/binding/config_validation_spec.rb +6 -100
- data/spec/binding/error_handling_spec.rb +97 -283
- data/spec/binding/plugins/ocr_backend_spec.rb +8 -8
- data/spec/binding/plugins/postprocessor_spec.rb +11 -11
- data/spec/binding/plugins/validator_spec.rb +13 -12
- data/spec/examples.txt +104 -0
- data/spec/fixtures/config.toml +1 -0
- data/spec/fixtures/config.yaml +1 -0
- data/spec/fixtures/invalid_config.toml +1 -0
- data/spec/smoke/package_spec.rb +3 -2
- data/spec/spec_helper.rb +3 -1
- data/vendor/kreuzberg/Cargo.toml +67 -192
- data/vendor/kreuzberg/README.md +9 -97
- data/vendor/kreuzberg/build.rs +194 -516
- data/vendor/kreuzberg/src/api/handlers.rs +9 -130
- data/vendor/kreuzberg/src/api/mod.rs +3 -18
- data/vendor/kreuzberg/src/api/server.rs +71 -236
- data/vendor/kreuzberg/src/api/types.rs +7 -43
- data/vendor/kreuzberg/src/bin/profile_extract.rs +455 -0
- data/vendor/kreuzberg/src/cache/mod.rs +3 -27
- data/vendor/kreuzberg/src/chunking/mod.rs +79 -1705
- data/vendor/kreuzberg/src/core/batch_mode.rs +0 -60
- data/vendor/kreuzberg/src/core/config.rs +23 -905
- data/vendor/kreuzberg/src/core/extractor.rs +106 -403
- data/vendor/kreuzberg/src/core/io.rs +2 -4
- data/vendor/kreuzberg/src/core/mime.rs +12 -2
- data/vendor/kreuzberg/src/core/mod.rs +3 -22
- data/vendor/kreuzberg/src/core/pipeline.rs +78 -395
- data/vendor/kreuzberg/src/embeddings.rs +21 -169
- data/vendor/kreuzberg/src/error.rs +2 -2
- data/vendor/kreuzberg/src/extraction/archive.rs +31 -36
- data/vendor/kreuzberg/src/extraction/docx.rs +1 -365
- data/vendor/kreuzberg/src/extraction/email.rs +11 -12
- data/vendor/kreuzberg/src/extraction/excel.rs +129 -138
- data/vendor/kreuzberg/src/extraction/html.rs +170 -1447
- data/vendor/kreuzberg/src/extraction/image.rs +14 -138
- data/vendor/kreuzberg/src/extraction/libreoffice.rs +3 -13
- data/vendor/kreuzberg/src/extraction/mod.rs +5 -21
- data/vendor/kreuzberg/src/extraction/office_metadata/mod.rs +0 -2
- data/vendor/kreuzberg/src/extraction/pandoc/batch.rs +275 -0
- data/vendor/kreuzberg/src/extraction/pandoc/mime_types.rs +178 -0
- data/vendor/kreuzberg/src/extraction/pandoc/mod.rs +491 -0
- data/vendor/kreuzberg/src/extraction/pandoc/server.rs +496 -0
- data/vendor/kreuzberg/src/extraction/pandoc/subprocess.rs +1188 -0
- data/vendor/kreuzberg/src/extraction/pandoc/version.rs +162 -0
- data/vendor/kreuzberg/src/extraction/pptx.rs +94 -196
- data/vendor/kreuzberg/src/extraction/structured.rs +4 -5
- data/vendor/kreuzberg/src/extraction/table.rs +1 -2
- data/vendor/kreuzberg/src/extraction/text.rs +10 -18
- data/vendor/kreuzberg/src/extractors/archive.rs +0 -22
- data/vendor/kreuzberg/src/extractors/docx.rs +148 -69
- data/vendor/kreuzberg/src/extractors/email.rs +9 -37
- data/vendor/kreuzberg/src/extractors/excel.rs +40 -81
- data/vendor/kreuzberg/src/extractors/html.rs +173 -182
- data/vendor/kreuzberg/src/extractors/image.rs +8 -32
- data/vendor/kreuzberg/src/extractors/mod.rs +10 -171
- data/vendor/kreuzberg/src/extractors/pandoc.rs +201 -0
- data/vendor/kreuzberg/src/extractors/pdf.rs +64 -329
- data/vendor/kreuzberg/src/extractors/pptx.rs +34 -79
- data/vendor/kreuzberg/src/extractors/structured.rs +0 -16
- data/vendor/kreuzberg/src/extractors/text.rs +7 -30
- data/vendor/kreuzberg/src/extractors/xml.rs +8 -27
- data/vendor/kreuzberg/src/keywords/processor.rs +1 -9
- data/vendor/kreuzberg/src/keywords/rake.rs +1 -0
- data/vendor/kreuzberg/src/language_detection/mod.rs +51 -94
- data/vendor/kreuzberg/src/lib.rs +5 -17
- data/vendor/kreuzberg/src/mcp/mod.rs +1 -4
- data/vendor/kreuzberg/src/mcp/server.rs +21 -145
- data/vendor/kreuzberg/src/ocr/mod.rs +0 -2
- data/vendor/kreuzberg/src/ocr/processor.rs +8 -19
- data/vendor/kreuzberg/src/ocr/tesseract_backend.rs +0 -2
- data/vendor/kreuzberg/src/pdf/error.rs +1 -93
- data/vendor/kreuzberg/src/pdf/metadata.rs +100 -263
- data/vendor/kreuzberg/src/pdf/mod.rs +2 -33
- data/vendor/kreuzberg/src/pdf/rendering.rs +12 -12
- data/vendor/kreuzberg/src/pdf/table.rs +64 -61
- data/vendor/kreuzberg/src/pdf/text.rs +24 -416
- data/vendor/kreuzberg/src/plugins/extractor.rs +8 -40
- data/vendor/kreuzberg/src/plugins/mod.rs +0 -3
- data/vendor/kreuzberg/src/plugins/ocr.rs +14 -22
- data/vendor/kreuzberg/src/plugins/processor.rs +1 -10
- data/vendor/kreuzberg/src/plugins/registry.rs +0 -15
- data/vendor/kreuzberg/src/plugins/validator.rs +8 -20
- data/vendor/kreuzberg/src/stopwords/mod.rs +2 -2
- data/vendor/kreuzberg/src/text/mod.rs +0 -8
- data/vendor/kreuzberg/src/text/quality.rs +15 -28
- data/vendor/kreuzberg/src/text/string_utils.rs +10 -22
- data/vendor/kreuzberg/src/text/token_reduction/core.rs +50 -86
- data/vendor/kreuzberg/src/text/token_reduction/filters.rs +16 -37
- data/vendor/kreuzberg/src/text/token_reduction/simd_text.rs +1 -2
- data/vendor/kreuzberg/src/types.rs +67 -907
- data/vendor/kreuzberg/src/utils/mod.rs +0 -14
- data/vendor/kreuzberg/src/utils/quality.rs +3 -12
- data/vendor/kreuzberg/tests/api_tests.rs +0 -506
- data/vendor/kreuzberg/tests/archive_integration.rs +0 -2
- data/vendor/kreuzberg/tests/batch_orchestration.rs +12 -57
- data/vendor/kreuzberg/tests/batch_processing.rs +8 -32
- data/vendor/kreuzberg/tests/chunking_offset_demo.rs +92 -0
- data/vendor/kreuzberg/tests/concurrency_stress.rs +8 -40
- data/vendor/kreuzberg/tests/config_features.rs +1 -33
- data/vendor/kreuzberg/tests/config_loading_tests.rs +39 -16
- data/vendor/kreuzberg/tests/core_integration.rs +9 -35
- data/vendor/kreuzberg/tests/csv_integration.rs +81 -71
- data/vendor/kreuzberg/tests/docx_metadata_extraction_test.rs +25 -23
- data/vendor/kreuzberg/tests/email_integration.rs +1 -3
- data/vendor/kreuzberg/tests/error_handling.rs +34 -43
- data/vendor/kreuzberg/tests/format_integration.rs +1 -7
- data/vendor/kreuzberg/tests/helpers/mod.rs +0 -60
- data/vendor/kreuzberg/tests/image_integration.rs +0 -2
- data/vendor/kreuzberg/tests/mime_detection.rs +16 -17
- data/vendor/kreuzberg/tests/ocr_configuration.rs +0 -4
- data/vendor/kreuzberg/tests/ocr_errors.rs +0 -22
- data/vendor/kreuzberg/tests/ocr_quality.rs +0 -2
- data/vendor/kreuzberg/tests/pandoc_integration.rs +503 -0
- data/vendor/kreuzberg/tests/pdf_integration.rs +0 -2
- data/vendor/kreuzberg/tests/pipeline_integration.rs +2 -36
- data/vendor/kreuzberg/tests/plugin_ocr_backend_test.rs +0 -5
- data/vendor/kreuzberg/tests/plugin_postprocessor_test.rs +1 -17
- data/vendor/kreuzberg/tests/plugin_system.rs +0 -6
- data/vendor/kreuzberg/tests/registry_integration_tests.rs +22 -2
- data/vendor/kreuzberg/tests/security_validation.rs +1 -13
- data/vendor/kreuzberg/tests/test_fastembed.rs +23 -45
- metadata +25 -171
- data/.rubocop.yml +0 -543
- data/ext/kreuzberg_rb/native/.cargo/config.toml +0 -23
- data/ext/kreuzberg_rb/native/Cargo.lock +0 -7619
- data/lib/kreuzberg/error_context.rb +0 -136
- data/lib/kreuzberg/types.rb +0 -170
- data/lib/libpdfium.so +0 -0
- data/spec/binding/async_operations_spec.rb +0 -473
- data/spec/binding/batch_operations_spec.rb +0 -595
- data/spec/binding/batch_spec.rb +0 -359
- data/spec/binding/config_result_spec.rb +0 -377
- data/spec/binding/embeddings_spec.rb +0 -816
- data/spec/binding/error_recovery_spec.rb +0 -488
- data/spec/binding/font_config_spec.rb +0 -220
- data/spec/binding/images_spec.rb +0 -738
- data/spec/binding/keywords_extraction_spec.rb +0 -600
- data/spec/binding/metadata_types_spec.rb +0 -1228
- data/spec/binding/pages_extraction_spec.rb +0 -471
- data/spec/binding/tables_spec.rb +0 -641
- data/spec/unit/config/chunking_config_spec.rb +0 -213
- data/spec/unit/config/embedding_config_spec.rb +0 -343
- data/spec/unit/config/extraction_config_spec.rb +0 -438
- data/spec/unit/config/font_config_spec.rb +0 -285
- data/spec/unit/config/hierarchy_config_spec.rb +0 -314
- data/spec/unit/config/image_extraction_config_spec.rb +0 -209
- data/spec/unit/config/image_preprocessing_config_spec.rb +0 -249
- data/spec/unit/config/keyword_config_spec.rb +0 -229
- data/spec/unit/config/language_detection_config_spec.rb +0 -258
- data/spec/unit/config/ocr_config_spec.rb +0 -171
- data/spec/unit/config/page_config_spec.rb +0 -221
- data/spec/unit/config/pdf_config_spec.rb +0 -267
- data/spec/unit/config/postprocessor_config_spec.rb +0 -290
- data/spec/unit/config/tesseract_config_spec.rb +0 -181
- data/spec/unit/config/token_reduction_config_spec.rb +0 -251
- data/test/metadata_types_test.rb +0 -959
- data/vendor/Cargo.toml +0 -61
- data/vendor/kreuzberg/examples/bench_fixes.rs +0 -71
- data/vendor/kreuzberg/examples/test_pdfium_fork.rs +0 -62
- data/vendor/kreuzberg/src/chunking/processor.rs +0 -219
- data/vendor/kreuzberg/src/core/batch_optimizations.rs +0 -385
- data/vendor/kreuzberg/src/core/config_validation.rs +0 -949
- data/vendor/kreuzberg/src/core/formats.rs +0 -235
- data/vendor/kreuzberg/src/core/server_config.rs +0 -1220
- data/vendor/kreuzberg/src/extraction/capacity.rs +0 -263
- data/vendor/kreuzberg/src/extraction/markdown.rs +0 -216
- data/vendor/kreuzberg/src/extraction/office_metadata/odt_properties.rs +0 -284
- data/vendor/kreuzberg/src/extractors/bibtex.rs +0 -470
- data/vendor/kreuzberg/src/extractors/docbook.rs +0 -504
- data/vendor/kreuzberg/src/extractors/epub.rs +0 -696
- data/vendor/kreuzberg/src/extractors/fictionbook.rs +0 -492
- data/vendor/kreuzberg/src/extractors/jats.rs +0 -1054
- data/vendor/kreuzberg/src/extractors/jupyter.rs +0 -368
- data/vendor/kreuzberg/src/extractors/latex.rs +0 -653
- data/vendor/kreuzberg/src/extractors/markdown.rs +0 -701
- data/vendor/kreuzberg/src/extractors/odt.rs +0 -628
- data/vendor/kreuzberg/src/extractors/opml.rs +0 -635
- data/vendor/kreuzberg/src/extractors/orgmode.rs +0 -529
- data/vendor/kreuzberg/src/extractors/rst.rs +0 -577
- data/vendor/kreuzberg/src/extractors/rtf.rs +0 -809
- data/vendor/kreuzberg/src/extractors/security.rs +0 -484
- data/vendor/kreuzberg/src/extractors/security_tests.rs +0 -367
- data/vendor/kreuzberg/src/extractors/typst.rs +0 -651
- data/vendor/kreuzberg/src/language_detection/processor.rs +0 -218
- data/vendor/kreuzberg/src/ocr/language_registry.rs +0 -520
- data/vendor/kreuzberg/src/panic_context.rs +0 -154
- data/vendor/kreuzberg/src/pdf/bindings.rs +0 -306
- data/vendor/kreuzberg/src/pdf/bundled.rs +0 -408
- data/vendor/kreuzberg/src/pdf/fonts.rs +0 -358
- data/vendor/kreuzberg/src/pdf/hierarchy.rs +0 -903
- data/vendor/kreuzberg/src/text/quality_processor.rs +0 -231
- data/vendor/kreuzberg/src/text/utf8_validation.rs +0 -193
- data/vendor/kreuzberg/src/utils/pool.rs +0 -503
- data/vendor/kreuzberg/src/utils/pool_sizing.rs +0 -364
- data/vendor/kreuzberg/src/utils/string_pool.rs +0 -761
- data/vendor/kreuzberg/tests/api_embed.rs +0 -360
- data/vendor/kreuzberg/tests/api_extract_multipart.rs +0 -52
- data/vendor/kreuzberg/tests/api_large_pdf_extraction.rs +0 -471
- data/vendor/kreuzberg/tests/api_large_pdf_extraction_diagnostics.rs +0 -289
- data/vendor/kreuzberg/tests/batch_pooling_benchmark.rs +0 -154
- data/vendor/kreuzberg/tests/bibtex_parity_test.rs +0 -421
- data/vendor/kreuzberg/tests/config_integration_test.rs +0 -753
- data/vendor/kreuzberg/tests/data/hierarchy_ground_truth.json +0 -294
- data/vendor/kreuzberg/tests/docbook_extractor_tests.rs +0 -500
- data/vendor/kreuzberg/tests/docx_vs_pandoc_comparison.rs +0 -370
- data/vendor/kreuzberg/tests/epub_native_extractor_tests.rs +0 -275
- data/vendor/kreuzberg/tests/fictionbook_extractor_tests.rs +0 -228
- data/vendor/kreuzberg/tests/html_table_test.rs +0 -551
- data/vendor/kreuzberg/tests/instrumentation_test.rs +0 -139
- data/vendor/kreuzberg/tests/jats_extractor_tests.rs +0 -639
- data/vendor/kreuzberg/tests/jupyter_extractor_tests.rs +0 -704
- data/vendor/kreuzberg/tests/latex_extractor_tests.rs +0 -496
- data/vendor/kreuzberg/tests/markdown_extractor_tests.rs +0 -490
- data/vendor/kreuzberg/tests/ocr_language_registry.rs +0 -191
- data/vendor/kreuzberg/tests/odt_extractor_tests.rs +0 -674
- data/vendor/kreuzberg/tests/opml_extractor_tests.rs +0 -616
- data/vendor/kreuzberg/tests/orgmode_extractor_tests.rs +0 -822
- data/vendor/kreuzberg/tests/page_markers.rs +0 -297
- data/vendor/kreuzberg/tests/pdf_hierarchy_detection.rs +0 -301
- data/vendor/kreuzberg/tests/pdf_hierarchy_quality.rs +0 -589
- data/vendor/kreuzberg/tests/pdf_ocr_triggering.rs +0 -301
- data/vendor/kreuzberg/tests/pdf_text_merging.rs +0 -475
- data/vendor/kreuzberg/tests/pdfium_linking.rs +0 -340
- data/vendor/kreuzberg/tests/rst_extractor_tests.rs +0 -694
- data/vendor/kreuzberg/tests/rtf_extractor_tests.rs +0 -775
- data/vendor/kreuzberg/tests/typst_behavioral_tests.rs +0 -1260
- data/vendor/kreuzberg/tests/typst_extractor_tests.rs +0 -648
- data/vendor/kreuzberg-ffi/Cargo.toml +0 -67
- data/vendor/kreuzberg-ffi/README.md +0 -851
- data/vendor/kreuzberg-ffi/benches/result_view_benchmark.rs +0 -227
- data/vendor/kreuzberg-ffi/build.rs +0 -168
- data/vendor/kreuzberg-ffi/cbindgen.toml +0 -37
- data/vendor/kreuzberg-ffi/kreuzberg-ffi.pc.in +0 -12
- data/vendor/kreuzberg-ffi/kreuzberg.h +0 -3012
- data/vendor/kreuzberg-ffi/src/batch_streaming.rs +0 -588
- data/vendor/kreuzberg-ffi/src/config.rs +0 -1341
- data/vendor/kreuzberg-ffi/src/error.rs +0 -901
- data/vendor/kreuzberg-ffi/src/extraction.rs +0 -555
- data/vendor/kreuzberg-ffi/src/helpers.rs +0 -879
- data/vendor/kreuzberg-ffi/src/lib.rs +0 -977
- data/vendor/kreuzberg-ffi/src/memory.rs +0 -493
- data/vendor/kreuzberg-ffi/src/mime.rs +0 -329
- data/vendor/kreuzberg-ffi/src/panic_shield.rs +0 -265
- data/vendor/kreuzberg-ffi/src/plugins/document_extractor.rs +0 -442
- data/vendor/kreuzberg-ffi/src/plugins/mod.rs +0 -14
- data/vendor/kreuzberg-ffi/src/plugins/ocr_backend.rs +0 -628
- data/vendor/kreuzberg-ffi/src/plugins/post_processor.rs +0 -438
- data/vendor/kreuzberg-ffi/src/plugins/validator.rs +0 -329
- data/vendor/kreuzberg-ffi/src/result.rs +0 -510
- data/vendor/kreuzberg-ffi/src/result_pool.rs +0 -639
- data/vendor/kreuzberg-ffi/src/result_view.rs +0 -773
- data/vendor/kreuzberg-ffi/src/string_intern.rs +0 -568
- data/vendor/kreuzberg-ffi/src/types.rs +0 -363
- data/vendor/kreuzberg-ffi/src/util.rs +0 -210
- data/vendor/kreuzberg-ffi/src/validation.rs +0 -848
- data/vendor/kreuzberg-ffi/tests.disabled/README.md +0 -48
- data/vendor/kreuzberg-ffi/tests.disabled/config_loading_tests.rs +0 -299
- data/vendor/kreuzberg-ffi/tests.disabled/config_tests.rs +0 -346
- data/vendor/kreuzberg-ffi/tests.disabled/extractor_tests.rs +0 -232
- data/vendor/kreuzberg-ffi/tests.disabled/plugin_registration_tests.rs +0 -470
- data/vendor/kreuzberg-tesseract/.commitlintrc.json +0 -13
- data/vendor/kreuzberg-tesseract/.crate-ignore +0 -2
- data/vendor/kreuzberg-tesseract/Cargo.lock +0 -2933
- data/vendor/kreuzberg-tesseract/Cargo.toml +0 -57
- data/vendor/kreuzberg-tesseract/LICENSE +0 -22
- data/vendor/kreuzberg-tesseract/README.md +0 -399
- data/vendor/kreuzberg-tesseract/build.rs +0 -1127
- data/vendor/kreuzberg-tesseract/patches/README.md +0 -71
- data/vendor/kreuzberg-tesseract/patches/tesseract.diff +0 -199
- data/vendor/kreuzberg-tesseract/src/api.rs +0 -1371
- data/vendor/kreuzberg-tesseract/src/choice_iterator.rs +0 -77
- data/vendor/kreuzberg-tesseract/src/enums.rs +0 -297
- data/vendor/kreuzberg-tesseract/src/error.rs +0 -81
- data/vendor/kreuzberg-tesseract/src/lib.rs +0 -145
- data/vendor/kreuzberg-tesseract/src/monitor.rs +0 -57
- data/vendor/kreuzberg-tesseract/src/mutable_iterator.rs +0 -197
- data/vendor/kreuzberg-tesseract/src/page_iterator.rs +0 -253
- data/vendor/kreuzberg-tesseract/src/result_iterator.rs +0 -286
- data/vendor/kreuzberg-tesseract/src/result_renderer.rs +0 -183
- data/vendor/kreuzberg-tesseract/tests/integration_test.rs +0 -211
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
//! Capacity estimation utilities for string pre-allocation.
|
|
2
|
-
//!
|
|
3
|
-
//! This module provides functions to estimate the optimal capacity for string buffers
|
|
4
|
-
//! based on file sizes and content types. By pre-allocating with accurate capacity hints,
|
|
5
|
-
//! we reduce reallocation cycles during text extraction and conversion operations.
|
|
6
|
-
//!
|
|
7
|
-
//! # Estimation Ratios
|
|
8
|
-
//!
|
|
9
|
-
//! Extraction ratios are based on empirical analysis of typical document conversions:
|
|
10
|
-
//! - **Plain text** (txt): ~95% of file size (minimal overhead)
|
|
11
|
-
//! - **Markdown** (md): ~95% of file size (minimal overhead)
|
|
12
|
-
//! - **HTML** (html/htm): ~65% of file size (tags removed, structure reduced)
|
|
13
|
-
//! - **DOCX** (docx): ~45% of compressed size (XML + compressed content)
|
|
14
|
-
//! - **Excel** (xlsx): ~40% of compressed size (cell values extracted)
|
|
15
|
-
//! - **PPTX** (pptx): ~35% of compressed size (slide content extracted)
|
|
16
|
-
//! - **PDF** (pdf): ~25% of file size (binary overhead, compression)
|
|
17
|
-
//! - **Default**: ~50% (conservative estimate)
|
|
18
|
-
//!
|
|
19
|
-
//! # Example
|
|
20
|
-
//!
|
|
21
|
-
//! ```
|
|
22
|
-
//! use kreuzberg::extraction::capacity::estimate_content_capacity;
|
|
23
|
-
//!
|
|
24
|
-
//! let file_size = 1_000_000u64;
|
|
25
|
-
//! let capacity_txt = estimate_content_capacity(file_size, "txt");
|
|
26
|
-
//! let capacity_html = estimate_content_capacity(file_size, "html");
|
|
27
|
-
//!
|
|
28
|
-
//! assert_eq!(capacity_txt, 950_000); // 95% of 1MB
|
|
29
|
-
//! assert_eq!(capacity_html, 650_000); // 65% of 1MB
|
|
30
|
-
//! ```
|
|
31
|
-
|
|
32
|
-
/// Estimate the capacity needed for content extracted from a file.
|
|
33
|
-
///
|
|
34
|
-
/// Returns an estimated byte capacity for a string buffer that will accumulate
|
|
35
|
-
/// extracted content. The estimation is based on:
|
|
36
|
-
/// - The original file size
|
|
37
|
-
/// - The content type/format
|
|
38
|
-
/// - Empirical ratios of final content size to original file size
|
|
39
|
-
///
|
|
40
|
-
/// # Arguments
|
|
41
|
-
///
|
|
42
|
-
/// * `file_size` - The size of the original file in bytes
|
|
43
|
-
/// * `format` - The file format/extension (e.g., "txt", "html", "docx", "xlsx", "pptx")
|
|
44
|
-
///
|
|
45
|
-
/// # Returns
|
|
46
|
-
///
|
|
47
|
-
/// An estimated capacity in bytes suitable for `String::with_capacity()`
|
|
48
|
-
///
|
|
49
|
-
/// # Minimum Capacity
|
|
50
|
-
///
|
|
51
|
-
/// All estimates have a minimum of 64 bytes to prevent over-optimization for very
|
|
52
|
-
/// small files where the overhead of capacity estimation outweighs benefits.
|
|
53
|
-
///
|
|
54
|
-
/// # Example
|
|
55
|
-
///
|
|
56
|
-
/// ```
|
|
57
|
-
/// use kreuzberg::extraction::capacity::estimate_content_capacity;
|
|
58
|
-
///
|
|
59
|
-
/// // 1MB text file → expect ~950KB of extracted content
|
|
60
|
-
/// let txt_cap = estimate_content_capacity(1_000_000, "txt");
|
|
61
|
-
/// assert_eq!(txt_cap, 950_000);
|
|
62
|
-
///
|
|
63
|
-
/// // 1MB HTML → expect ~650KB of extracted markdown
|
|
64
|
-
/// let html_cap = estimate_content_capacity(1_000_000, "html");
|
|
65
|
-
/// assert_eq!(html_cap, 650_000);
|
|
66
|
-
///
|
|
67
|
-
/// // 1MB DOCX → expect ~450KB of extracted text
|
|
68
|
-
/// let docx_cap = estimate_content_capacity(1_000_000, "docx");
|
|
69
|
-
/// assert_eq!(docx_cap, 450_000);
|
|
70
|
-
/// ```
|
|
71
|
-
#[inline]
|
|
72
|
-
pub fn estimate_content_capacity(file_size: u64, format: &str) -> usize {
|
|
73
|
-
let ratio = match format.to_lowercase().as_str() {
|
|
74
|
-
"txt" | "text" => 0.95,
|
|
75
|
-
"md" | "markdown" => 0.95,
|
|
76
|
-
"html" | "htm" => 0.65,
|
|
77
|
-
"docx" | "doc" => 0.45,
|
|
78
|
-
"xlsx" | "xls" | "xlsm" | "xlam" | "xltm" | "xlsb" => 0.40,
|
|
79
|
-
"pptx" | "ppt" | "pptm" | "ppsx" => 0.35,
|
|
80
|
-
"pdf" => 0.25,
|
|
81
|
-
_ => 0.50,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
(file_size as f64 * ratio).ceil() as usize
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/// Estimate capacity for HTML to Markdown conversion.
|
|
88
|
-
///
|
|
89
|
-
/// HTML documents typically convert to Markdown with 60-70% of the original size.
|
|
90
|
-
/// This function estimates capacity specifically for HTML→Markdown conversion.
|
|
91
|
-
///
|
|
92
|
-
/// # Arguments
|
|
93
|
-
///
|
|
94
|
-
/// * `html_size` - The size of the HTML file in bytes
|
|
95
|
-
///
|
|
96
|
-
/// # Returns
|
|
97
|
-
///
|
|
98
|
-
/// An estimated capacity for the Markdown output
|
|
99
|
-
#[inline]
|
|
100
|
-
pub fn estimate_html_markdown_capacity(html_size: u64) -> usize {
|
|
101
|
-
let estimated = (html_size as f64 * 0.65).ceil() as usize;
|
|
102
|
-
estimated.max(64)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/// Estimate capacity for cell extraction from spreadsheets.
|
|
106
|
-
///
|
|
107
|
-
/// When extracting cell data from Excel/ODS files, the extracted cells are typically
|
|
108
|
-
/// 40% of the compressed file size (since the file is ZIP-compressed).
|
|
109
|
-
///
|
|
110
|
-
/// # Arguments
|
|
111
|
-
///
|
|
112
|
-
/// * `file_size` - Size of the spreadsheet file (XLSX, ODS, etc.)
|
|
113
|
-
///
|
|
114
|
-
/// # Returns
|
|
115
|
-
///
|
|
116
|
-
/// An estimated capacity for cell value accumulation
|
|
117
|
-
#[inline]
|
|
118
|
-
pub fn estimate_spreadsheet_capacity(file_size: u64) -> usize {
|
|
119
|
-
let estimated = (file_size as f64 * 0.40).ceil() as usize;
|
|
120
|
-
estimated.max(64)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/// Estimate capacity for slide content extraction from presentations.
|
|
124
|
-
///
|
|
125
|
-
/// PPTX files when extracted have slide content at approximately 35% of the file size.
|
|
126
|
-
/// This accounts for XML overhead, compression, and embedded assets.
|
|
127
|
-
///
|
|
128
|
-
/// # Arguments
|
|
129
|
-
///
|
|
130
|
-
/// * `file_size` - Size of the PPTX file in bytes
|
|
131
|
-
///
|
|
132
|
-
/// # Returns
|
|
133
|
-
///
|
|
134
|
-
/// An estimated capacity for slide content accumulation
|
|
135
|
-
#[inline]
|
|
136
|
-
pub fn estimate_presentation_capacity(file_size: u64) -> usize {
|
|
137
|
-
let estimated = (file_size as f64 * 0.35).ceil() as usize;
|
|
138
|
-
estimated.max(64)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/// Estimate capacity for markdown table generation.
|
|
142
|
-
///
|
|
143
|
-
/// Markdown tables have predictable size: ~12 bytes per cell on average
|
|
144
|
-
/// (accounting for separators, pipes, padding, and cell content).
|
|
145
|
-
///
|
|
146
|
-
/// # Arguments
|
|
147
|
-
///
|
|
148
|
-
/// * `row_count` - Number of rows in the table
|
|
149
|
-
/// * `col_count` - Number of columns in the table
|
|
150
|
-
///
|
|
151
|
-
/// # Returns
|
|
152
|
-
///
|
|
153
|
-
/// An estimated capacity for the markdown table output
|
|
154
|
-
#[inline]
|
|
155
|
-
pub fn estimate_table_markdown_capacity(row_count: usize, col_count: usize) -> usize {
|
|
156
|
-
let base = 50 + (col_count * 5);
|
|
157
|
-
let cell_estimate = row_count.saturating_mul(col_count).saturating_mul(12);
|
|
158
|
-
base.saturating_add(cell_estimate).max(64)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
#[cfg(test)]
|
|
162
|
-
mod tests {
|
|
163
|
-
use super::*;
|
|
164
|
-
|
|
165
|
-
#[test]
|
|
166
|
-
fn test_estimate_content_capacity_text() {
|
|
167
|
-
let capacity = estimate_content_capacity(1_000_000, "txt");
|
|
168
|
-
assert_eq!(capacity, 950_000);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
#[test]
|
|
172
|
-
fn test_estimate_content_capacity_markdown() {
|
|
173
|
-
let capacity = estimate_content_capacity(1_000_000, "md");
|
|
174
|
-
assert_eq!(capacity, 950_000);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
#[test]
|
|
178
|
-
fn test_estimate_content_capacity_html() {
|
|
179
|
-
let capacity = estimate_content_capacity(1_000_000, "html");
|
|
180
|
-
assert_eq!(capacity, 650_000);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
#[test]
|
|
184
|
-
fn test_estimate_content_capacity_docx() {
|
|
185
|
-
let capacity = estimate_content_capacity(1_000_000, "docx");
|
|
186
|
-
assert_eq!(capacity, 450_000);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
#[test]
|
|
190
|
-
fn test_estimate_content_capacity_xlsx() {
|
|
191
|
-
let capacity = estimate_content_capacity(1_000_000, "xlsx");
|
|
192
|
-
assert_eq!(capacity, 400_000);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
#[test]
|
|
196
|
-
fn test_estimate_content_capacity_pptx() {
|
|
197
|
-
let capacity = estimate_content_capacity(1_000_000, "pptx");
|
|
198
|
-
assert_eq!(capacity, 350_000);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
#[test]
|
|
202
|
-
fn test_estimate_content_capacity_pdf() {
|
|
203
|
-
let capacity = estimate_content_capacity(1_000_000, "pdf");
|
|
204
|
-
assert_eq!(capacity, 250_000);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
#[test]
|
|
208
|
-
fn test_estimate_content_capacity_unknown() {
|
|
209
|
-
let capacity = estimate_content_capacity(1_000_000, "unknown");
|
|
210
|
-
assert_eq!(capacity, 500_000);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
#[test]
|
|
214
|
-
fn test_estimate_content_capacity_case_insensitive() {
|
|
215
|
-
let lower = estimate_content_capacity(1_000_000, "html");
|
|
216
|
-
let upper = estimate_content_capacity(1_000_000, "HTML");
|
|
217
|
-
let mixed = estimate_content_capacity(1_000_000, "HtMl");
|
|
218
|
-
assert_eq!(lower, upper);
|
|
219
|
-
assert_eq!(lower, mixed);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
#[test]
|
|
223
|
-
fn test_html_markdown_capacity() {
|
|
224
|
-
let capacity = estimate_html_markdown_capacity(1_000_000);
|
|
225
|
-
assert_eq!(capacity, 650_000);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
#[test]
|
|
229
|
-
fn test_html_markdown_capacity_minimum() {
|
|
230
|
-
let capacity = estimate_html_markdown_capacity(10);
|
|
231
|
-
assert!(capacity >= 64);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
#[test]
|
|
235
|
-
fn test_spreadsheet_capacity() {
|
|
236
|
-
let capacity = estimate_spreadsheet_capacity(1_000_000);
|
|
237
|
-
assert_eq!(capacity, 400_000);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
#[test]
|
|
241
|
-
fn test_presentation_capacity() {
|
|
242
|
-
let capacity = estimate_presentation_capacity(1_000_000);
|
|
243
|
-
assert_eq!(capacity, 350_000);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn test_table_markdown_capacity() {
|
|
248
|
-
let capacity = estimate_table_markdown_capacity(10, 5);
|
|
249
|
-
assert_eq!(capacity, 675);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
#[test]
|
|
253
|
-
fn test_table_markdown_capacity_minimum() {
|
|
254
|
-
let capacity = estimate_table_markdown_capacity(0, 0);
|
|
255
|
-
assert!(capacity >= 64);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
#[test]
|
|
259
|
-
fn test_capacity_overflow_resistance() {
|
|
260
|
-
let capacity = estimate_content_capacity(u64::MAX, "txt");
|
|
261
|
-
assert!(capacity > 0);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
//! Markdown table formatting utilities
|
|
2
|
-
//!
|
|
3
|
-
//! This module provides utilities for converting tabular data into GitHub-Flavored Markdown (GFM) tables.
|
|
4
|
-
//! It's used by multiple extractors (DOCX, HTML) that need to represent structured table data in markdown format.
|
|
5
|
-
|
|
6
|
-
use crate::extraction::capacity;
|
|
7
|
-
|
|
8
|
-
/// Converts a 2D vector of cell strings into a GitHub-Flavored Markdown table.
|
|
9
|
-
///
|
|
10
|
-
/// # Behavior
|
|
11
|
-
///
|
|
12
|
-
/// - The first row is treated as the header row
|
|
13
|
-
/// - A separator row is inserted after the header
|
|
14
|
-
/// - Pipe characters (`|`) in cell content are automatically escaped with backslash
|
|
15
|
-
/// - Irregular tables (rows with varying column counts) are padded with empty cells to match the header
|
|
16
|
-
/// - Returns an empty string for empty input
|
|
17
|
-
///
|
|
18
|
-
/// # Arguments
|
|
19
|
-
///
|
|
20
|
-
/// * `cells` - A slice of vectors representing table rows, where each inner vector contains cell values
|
|
21
|
-
///
|
|
22
|
-
/// # Returns
|
|
23
|
-
///
|
|
24
|
-
/// A `String` containing the GFM markdown table representation
|
|
25
|
-
///
|
|
26
|
-
/// # Examples
|
|
27
|
-
///
|
|
28
|
-
/// ```
|
|
29
|
-
/// # use kreuzberg::extraction::cells_to_markdown;
|
|
30
|
-
/// let cells = vec![
|
|
31
|
-
/// vec!["Name".to_string(), "Age".to_string()],
|
|
32
|
-
/// vec!["Alice".to_string(), "30".to_string()],
|
|
33
|
-
/// vec!["Bob".to_string(), "25".to_string()],
|
|
34
|
-
/// ];
|
|
35
|
-
///
|
|
36
|
-
/// let markdown = cells_to_markdown(&cells);
|
|
37
|
-
/// assert!(markdown.contains("| Name | Age |"));
|
|
38
|
-
/// assert!(markdown.contains("|------|------|"));
|
|
39
|
-
/// ```
|
|
40
|
-
pub fn cells_to_markdown(cells: &[Vec<String>]) -> String {
|
|
41
|
-
if cells.is_empty() {
|
|
42
|
-
return String::new();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let num_cols = cells.first().map(|r| r.len()).unwrap_or(0);
|
|
46
|
-
if num_cols == 0 {
|
|
47
|
-
return String::new();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let estimated_capacity = capacity::estimate_table_markdown_capacity(cells.len(), num_cols);
|
|
51
|
-
let mut markdown = String::with_capacity(estimated_capacity);
|
|
52
|
-
|
|
53
|
-
if let Some(header) = cells.first() {
|
|
54
|
-
markdown.push('|');
|
|
55
|
-
for cell in header {
|
|
56
|
-
markdown.push(' ');
|
|
57
|
-
let escaped = cell.replace('|', "\\|");
|
|
58
|
-
markdown.push_str(&escaped);
|
|
59
|
-
markdown.push_str(" |");
|
|
60
|
-
}
|
|
61
|
-
markdown.push('\n');
|
|
62
|
-
|
|
63
|
-
markdown.push('|');
|
|
64
|
-
for _ in 0..num_cols {
|
|
65
|
-
markdown.push_str("------|");
|
|
66
|
-
}
|
|
67
|
-
markdown.push('\n');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
for row in cells.iter().skip(1) {
|
|
71
|
-
markdown.push('|');
|
|
72
|
-
for (idx, cell) in row.iter().enumerate() {
|
|
73
|
-
if idx >= num_cols {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
markdown.push(' ');
|
|
77
|
-
let escaped = cell.replace('|', "\\|");
|
|
78
|
-
markdown.push_str(&escaped);
|
|
79
|
-
markdown.push_str(" |");
|
|
80
|
-
}
|
|
81
|
-
for _ in row.len()..num_cols {
|
|
82
|
-
markdown.push_str(" |");
|
|
83
|
-
}
|
|
84
|
-
markdown.push('\n');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
markdown
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
#[cfg(test)]
|
|
91
|
-
mod tests {
|
|
92
|
-
use super::*;
|
|
93
|
-
|
|
94
|
-
#[test]
|
|
95
|
-
fn test_markdown_formatting_from_simple_table() {
|
|
96
|
-
let cells = vec![
|
|
97
|
-
vec!["Header1".to_string(), "Header2".to_string()],
|
|
98
|
-
vec!["Row1Col1".to_string(), "Row1Col2".to_string()],
|
|
99
|
-
vec!["Row2Col1".to_string(), "Row2Col2".to_string()],
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
let markdown = cells_to_markdown(&cells);
|
|
103
|
-
|
|
104
|
-
assert!(markdown.contains("| Header1 | Header2 |"));
|
|
105
|
-
assert!(markdown.contains("|------|------|"));
|
|
106
|
-
assert!(markdown.contains("| Row1Col1 | Row1Col2 |"));
|
|
107
|
-
assert!(markdown.contains("| Row2Col1 | Row2Col2 |"));
|
|
108
|
-
|
|
109
|
-
let lines: Vec<&str> = markdown.lines().collect();
|
|
110
|
-
assert_eq!(lines.len(), 4);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
#[test]
|
|
114
|
-
fn test_markdown_handles_empty_input() {
|
|
115
|
-
let cells: Vec<Vec<String>> = vec![];
|
|
116
|
-
|
|
117
|
-
let markdown = cells_to_markdown(&cells);
|
|
118
|
-
|
|
119
|
-
assert_eq!(markdown, "");
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
#[test]
|
|
123
|
-
fn test_markdown_escapes_pipe_characters() {
|
|
124
|
-
let cells = vec![vec!["Header".to_string()], vec!["Cell with | pipe".to_string()]];
|
|
125
|
-
|
|
126
|
-
let markdown = cells_to_markdown(&cells);
|
|
127
|
-
|
|
128
|
-
assert!(markdown.contains("Cell with \\| pipe"));
|
|
129
|
-
|
|
130
|
-
for line in markdown.lines() {
|
|
131
|
-
if !line.is_empty() {
|
|
132
|
-
assert!(line.starts_with('|'));
|
|
133
|
-
assert!(line.ends_with('|'));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
#[test]
|
|
139
|
-
fn test_markdown_pads_irregular_tables() {
|
|
140
|
-
let cells = vec![
|
|
141
|
-
vec!["H1".to_string(), "H2".to_string(), "H3".to_string()],
|
|
142
|
-
vec!["R1C1".to_string(), "R1C2".to_string()],
|
|
143
|
-
vec!["R2C1".to_string(), "R2C2".to_string(), "R2C3".to_string()],
|
|
144
|
-
];
|
|
145
|
-
|
|
146
|
-
let markdown = cells_to_markdown(&cells);
|
|
147
|
-
|
|
148
|
-
assert!(markdown.contains("| H1 | H2 | H3 |"));
|
|
149
|
-
|
|
150
|
-
assert!(markdown.contains("| R1C1 | R1C2 | |"));
|
|
151
|
-
|
|
152
|
-
let lines: Vec<&str> = markdown.lines().filter(|l| !l.is_empty()).collect();
|
|
153
|
-
let pipe_counts: Vec<usize> = lines
|
|
154
|
-
.iter()
|
|
155
|
-
.map(|line| line.chars().filter(|c| *c == '|').count())
|
|
156
|
-
.collect();
|
|
157
|
-
assert!(pipe_counts.iter().all(|&count| count == pipe_counts[0]));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
#[test]
|
|
161
|
-
fn test_markdown_single_row_table() {
|
|
162
|
-
let cells = vec![vec!["OnlyHeader".to_string()]];
|
|
163
|
-
|
|
164
|
-
let markdown = cells_to_markdown(&cells);
|
|
165
|
-
|
|
166
|
-
assert!(markdown.contains("| OnlyHeader |"));
|
|
167
|
-
assert!(markdown.contains("|------|"));
|
|
168
|
-
|
|
169
|
-
let lines: Vec<&str> = markdown.lines().collect();
|
|
170
|
-
assert_eq!(lines.len(), 2);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
#[test]
|
|
174
|
-
fn test_markdown_single_column_table() {
|
|
175
|
-
let cells = vec![
|
|
176
|
-
vec!["Header".to_string()],
|
|
177
|
-
vec!["Data1".to_string()],
|
|
178
|
-
vec!["Data2".to_string()],
|
|
179
|
-
];
|
|
180
|
-
|
|
181
|
-
let markdown = cells_to_markdown(&cells);
|
|
182
|
-
|
|
183
|
-
assert!(markdown.contains("| Header |"));
|
|
184
|
-
assert!(markdown.contains("|------|"));
|
|
185
|
-
assert!(markdown.contains("| Data1 |"));
|
|
186
|
-
assert!(markdown.contains("| Data2 |"));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
#[test]
|
|
190
|
-
fn test_markdown_special_characters() {
|
|
191
|
-
let cells = vec![
|
|
192
|
-
vec!["*Header*".to_string(), "#Title".to_string()],
|
|
193
|
-
vec!["**Bold**".to_string(), "~~Strike~~".to_string()],
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
let markdown = cells_to_markdown(&cells);
|
|
197
|
-
|
|
198
|
-
assert!(markdown.contains("*Header*"));
|
|
199
|
-
assert!(markdown.contains("#Title"));
|
|
200
|
-
assert!(markdown.contains("**Bold**"));
|
|
201
|
-
assert!(markdown.contains("~~Strike~~"));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
#[test]
|
|
205
|
-
fn test_markdown_unicode_content() {
|
|
206
|
-
let cells = vec![
|
|
207
|
-
vec!["Emoji".to_string(), "Accents".to_string()],
|
|
208
|
-
vec!["🎉 Party".to_string(), "Café".to_string()],
|
|
209
|
-
];
|
|
210
|
-
|
|
211
|
-
let markdown = cells_to_markdown(&cells);
|
|
212
|
-
|
|
213
|
-
assert!(markdown.contains("🎉 Party"));
|
|
214
|
-
assert!(markdown.contains("Café"));
|
|
215
|
-
}
|
|
216
|
-
}
|