apex-ruby 1.0.6
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 +7 -0
- data/README.md +119 -0
- data/apex-ruby.gemspec +31 -0
- data/ext/apex_ext/apex_ext.c +215 -0
- data/ext/apex_ext/apex_src/BENCHMARK.md +32 -0
- data/ext/apex_ext/apex_src/BENCHMARK_COMPARISON.md +67 -0
- data/ext/apex_ext/apex_src/CHANGELOG.md +2454 -0
- data/ext/apex_ext/apex_src/CMakeLists.txt +454 -0
- data/ext/apex_ext/apex_src/Dockerfile.linux-build +15 -0
- data/ext/apex_ext/apex_src/Formula/apex.rb +38 -0
- data/ext/apex_ext/apex_src/Info.plist.in +27 -0
- data/ext/apex_ext/apex_src/LICENSE +21 -0
- data/ext/apex_ext/apex_src/Package.swift +160 -0
- data/ext/apex_ext/apex_src/PackageSupport/README.md +17 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_export.h +20 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_version.h +14 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark_gfm_spm_stub.c +4 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/config.h +41 -0
- data/ext/apex_ext/apex_src/README.md +452 -0
- data/ext/apex_ext/apex_src/VERSION +1 -0
- data/ext/apex_ext/apex_src/apex-header-2-rb@2x.webp +0 -0
- data/ext/apex_ext/apex_src/apex-plugins.json.example +20 -0
- data/ext/apex_ext/apex_src/apex.pc.in +11 -0
- data/ext/apex_ext/apex_src/cli/main.c +2720 -0
- data/ext/apex_ext/apex_src/debug_test.sh +22 -0
- data/ext/apex_ext/apex_src/docs/API_REFERENCE.md +451 -0
- data/ext/apex_ext/apex_src/docs/ARCHITECTURE.md +166 -0
- data/ext/apex_ext/apex_src/docs/CMARK_INTEGRATION.md +220 -0
- data/ext/apex_ext/apex_src/docs/CRITICMARKUP.md +501 -0
- data/ext/apex_ext/apex_src/docs/DEBUGGING.md +73 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS.md +391 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS_UPDATE.md +237 -0
- data/ext/apex_ext/apex_src/docs/FUTURE_FEATURES.md +456 -0
- data/ext/apex_ext/apex_src/docs/IAL_FEATURES.md +210 -0
- data/ext/apex_ext/apex_src/docs/IAL_STATUS.md +344 -0
- data/ext/apex_ext/apex_src/docs/INTEGRATION_EXAMPLE.m +144 -0
- data/ext/apex_ext/apex_src/docs/LIMITATIONS_RESOLVED.md +278 -0
- data/ext/apex_ext/apex_src/docs/OUTPUT_MODES.md +321 -0
- data/ext/apex_ext/apex_src/docs/PROGRESS.md +167 -0
- data/ext/apex_ext/apex_src/docs/STANDALONE_FEATURE.md +174 -0
- data/ext/apex_ext/apex_src/docs/TABLE_SPANS_STATUS.md +243 -0
- data/ext/apex_ext/apex_src/docs/TEST_COVERAGE.md +316 -0
- data/ext/apex_ext/apex_src/docs/USER_GUIDE.md +803 -0
- data/ext/apex_ext/apex_src/docs/WIKI_LINKS_ISSUE.md +91 -0
- data/ext/apex_ext/apex_src/documentation/README.md +160 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex Command Line Options.cheatsheet.txt +365 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Info.plist +24 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/C-API.html +1737 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Citations.html +1420 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Command-Line-Options.html +3574 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Configuration.html +1603 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Credits.html +910 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Examples.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Getting-Started.html +1003 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Header-IDs.html +1308 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Home.html +1078 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Inline-Attribute-Lists.html +1622 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Installation.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Limitations-and-Roadmap.html +1698 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Metadata-Transforms.html +1531 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Modes.html +1980 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-File-Documents.html +1368 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Pandoc-Integration.html +1151 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Plugins.html +2861 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Syntax.html +3981 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Troubleshooting.html +1454 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Usage.html +1200 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Xcode-Integration.html +2066 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/tempOptimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Info.plist +22 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/index.html +914 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/style.css +399 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs.rb +772 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs_ai.rb +678 -0
- data/ext/apex_ext/apex_src/documentation/generate_docset.rb +873 -0
- data/ext/apex_ext/apex_src/documentation/generate_single_html.rb +733 -0
- data/ext/apex_ext/apex_src/documentation/html/apex-docs.html +17073 -0
- data/ext/apex_ext/apex_src/documentation/shared_scripts.js +64 -0
- data/ext/apex_ext/apex_src/documentation/shared_styles.css +646 -0
- data/ext/apex_ext/apex_src/documentation/transform_for_app.example.md +260 -0
- data/ext/apex_ext/apex_src/examples/bracketed_spans_demo.md +119 -0
- data/ext/apex_ext/apex_src/examples/emoji_span_plugin.yml +11 -0
- data/ext/apex_ext/apex_src/examples/example.html +53 -0
- data/ext/apex_ext/apex_src/examples/example.md +85 -0
- data/ext/apex_ext/apex_src/examples/fenced_divs_demo.md +158 -0
- data/ext/apex_ext/apex_src/examples/kbd.md +8 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.rb +250 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.yml +9 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon@2x.png +0 -0
- data/ext/apex_ext/apex_src/include/apex/apex.h +247 -0
- data/ext/apex_ext/apex_src/include/apex/buffer.h +93 -0
- data/ext/apex_ext/apex_src/include/apex/module.modulemap +16 -0
- data/ext/apex_ext/apex_src/include/apex/parser.h +150 -0
- data/ext/apex_ext/apex_src/include/apex/renderer.h +39 -0
- data/ext/apex_ext/apex_src/man/apex-config.5 +374 -0
- data/ext/apex_ext/apex_src/man/apex-config.5.md +260 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7 +456 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7.md +365 -0
- data/ext/apex_ext/apex_src/man/apex.1 +828 -0
- data/ext/apex_ext/apex_src/man/apex.1.md +643 -0
- data/ext/apex_ext/apex_src/man/apex.1.new +338 -0
- data/ext/apex_ext/apex_src/objc/Apex.swift +237 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.h +117 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.m +332 -0
- data/ext/apex_ext/apex_src/src/_README.md +358 -0
- data/ext/apex_ext/apex_src/src/apex.c +6326 -0
- data/ext/apex_ext/apex_src/src/buffer.c +93 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +362 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.h +45 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.c +184 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.h +50 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.c +1897 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.c +215 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.h +53 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.c +2042 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.h +163 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.c +329 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.h +48 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.c +1670 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.c +710 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.h +38 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji_data.h +942 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.c +925 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.h +43 -0
- data/ext/apex_ext/apex_src/src/extensions/github-emoji.txt +869 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.c +1121 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.h +33 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.c +626 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.h +60 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.c +135 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.c +408 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.c +4084 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.h +145 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.c +1536 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.h +54 -0
- data/ext/apex_ext/apex_src/src/extensions/index.c +967 -0
- data/ext/apex_ext/apex_src/src/extensions/index.h +90 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.c +205 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.c +332 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.h +13 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.c +248 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.h +18 -0
- data/ext/apex_ext/apex_src/src/extensions/math.c +279 -0
- data/ext/apex_ext/apex_src/src/extensions/math.h +32 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.c +3046 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.h +125 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.c +1297 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.h +39 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.c +194 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.h +29 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.c +405 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +468 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.h +44 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +2679 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.h +23 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.c +255 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.c +624 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.h +58 -0
- data/ext/apex_ext/apex_src/src/html_renderer.c +2762 -0
- data/ext/apex_ext/apex_src/src/html_renderer.h +126 -0
- data/ext/apex_ext/apex_src/src/parser.c +227 -0
- data/ext/apex_ext/apex_src/src/plugins.c +895 -0
- data/ext/apex_ext/apex_src/src/plugins.h +39 -0
- data/ext/apex_ext/apex_src/src/plugins_env.c +187 -0
- data/ext/apex_ext/apex_src/src/plugins_remote.c +263 -0
- data/ext/apex_ext/apex_src/src/pretty_html.c +358 -0
- data/ext/apex_ext/apex_src/src/renderer.c +241 -0
- data/ext/apex_ext/apex_src/src/utf8.c +56 -0
- data/ext/apex_ext/apex_src/test-linux-build.sh +20 -0
- data/ext/apex_ext/apex_src/test.html +103 -0
- data/ext/apex_ext/apex_src/test_coverage.sh +121 -0
- data/ext/apex_ext/apex_src/test_ial_fenced.md +6 -0
- data/ext/apex_ext/apex_src/test_math_norm.py +79 -0
- data/ext/apex_ext/apex_src/test_pandoc_output.html +48 -0
- data/ext/apex_ext/apex_src/test_spm.sh +107 -0
- data/ext/apex_ext/apex_src/tests/ApexSPMTest/main.swift +50 -0
- data/ext/apex_ext/apex_src/tests/BENCHMARK_RESULTS.md +229 -0
- data/ext/apex_ext/apex_src/tests/CMakeLists.txt +24 -0
- data/ext/apex_ext/apex_src/tests/README.md +146 -0
- data/ext/apex_ext/apex_src/tests/benchmark.sh +113 -0
- data/ext/apex_ext/apex_src/tests/benchmark_comparison.sh +166 -0
- data/ext/apex_ext/apex_src/tests/compare_header_ids.sh +31 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/headers.md +25 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/list-interruption.md +24 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/misc_markup.md +33 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/test_basic.md +26 -0
- data/ext/apex_ext/apex_src/tests/fixtures/code/code-blocks.md +260 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/SUMMARY.md +6 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/chapter1.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/index.txt +9 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/intro.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/section1_1.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +620 -0
- data/ext/apex_ext/apex_src/tests/fixtures/debug_ref_image_ial.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial.md +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial_demo.md +177 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji-autocorrect.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/kbd_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/ial/bracketed_spans_test.md +74 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/image_and_encoding_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/multimarkdown_image_attributes_test.md +60 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/pandoc_ial_image_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/width_height_conversion_test.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/img-in-div.md +16 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/code.py +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.csv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.tsv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/image.png +2 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/nested.md +8 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/raw.html +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/simple.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/test_image.png +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/large_doc.md +1094 -0
- data/ext/apex_ext/apex_src/tests/fixtures/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/gfm_header_id_test.md +96 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_citations.md +43 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_def_list_links.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_mmark.md +53 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_textindex.md +37 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/advanced_tables_test.md +93 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/inline_tables_test.md +38 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/relaxed-table.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_cr_line_endings.md +15 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_no_trailing_newline.md +15 -0
- data/ext/apex_ext/apex_src/tests/generate_gfm_ids.sh +105 -0
- data/ext/apex_ext/apex_src/tests/generate_ial_demo.sh +143 -0
- data/ext/apex_ext/apex_src/tests/gfm_id_comparison_summary.md +96 -0
- data/ext/apex_ext/apex_src/tests/gh_api_test.md +6 -0
- data/ext/apex_ext/apex_src/tests/ial_demo.html +186 -0
- data/ext/apex_ext/apex_src/tests/include_code.py +19 -0
- data/ext/apex_ext/apex_src/tests/include_snippet.md +15 -0
- data/ext/apex_ext/apex_src/tests/multi_file_cli_test.sh +64 -0
- data/ext/apex_ext/apex_src/tests/sample_data.csv +7 -0
- data/ext/apex_ext/apex_src/tests/table_escaped_ltlt.md +4 -0
- data/ext/apex_ext/apex_src/tests/test_basic.c +74 -0
- data/ext/apex_ext/apex_src/tests/test_extensions.c +2116 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.c +183 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.h +91 -0
- data/ext/apex_ext/apex_src/tests/test_ial.c +282 -0
- data/ext/apex_ext/apex_src/tests/test_links.c +418 -0
- data/ext/apex_ext/apex_src/tests/test_marked_integration.c +265 -0
- data/ext/apex_ext/apex_src/tests/test_metadata.c +908 -0
- data/ext/apex_ext/apex_src/tests/test_output.c +1118 -0
- data/ext/apex_ext/apex_src/tests/test_plugins.c +219 -0
- data/ext/apex_ext/apex_src/tests/test_refs.bib +31 -0
- data/ext/apex_ext/apex_src/tests/test_runner.c +244 -0
- data/ext/apex_ext/apex_src/tests/test_syntax_highlight.c +198 -0
- data/ext/apex_ext/apex_src/tests/test_tables.c +862 -0
- data/ext/apex_ext/apex_src/tests/update_benchmarks.sh +9 -0
- data/ext/apex_ext/apex_src/tests/yaml_test.md +13 -0
- data/ext/apex_ext/apex_src/tests.rb +39 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CMakeLists.txt +48 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/COPYING +170 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.c +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.cmake +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/FindAsan.cmake +74 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/Makefile.nmake +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/README.md +206 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/CMakeLists.txt +30 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.cpp +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.h +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.c +111 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/main.c +1169 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/appveyor.yml +21 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-flat.md +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-code.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-fences.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-heading.md +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-hr.md +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-html.md +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-lheading.md +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-flat.md +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-nested.md +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-flat.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-nested.md +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-autolink.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-backticks.md +3 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-flat.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-nested.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-worst.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-entity.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-escape.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-html.md +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-flat.md +23 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-newlines.md +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/lorem1.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/rawtabs.md +18 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/statistics.py +595 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/stats.py +19 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/benchmarks.md +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/changelog.txt +1245 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/data/CaseFolding.txt +1495 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/CMakeLists.txt +119 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.c +508 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/cmark-gfm-core-extensions.h +54 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/core-extensions.c +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.c +879 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.re +92 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.c +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.h +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.c +917 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.h +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.c +60 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.c +156 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/CMakeLists.txt +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/README.md +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic.c +91 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic_brackets.c +110 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzzloop.sh +28 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/CMakeLists.txt +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/make_man_page.py +133 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man1/cmark-gfm.1 +78 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man3/cmark-gfm.3 +1041 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/nmake.bat +1 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/CMakeLists.txt +230 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/arena.c +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/blocks.c +1622 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.c +278 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.h +116 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/case_fold_switch.inc +4327 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/chunk.h +135 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm-extension_api.h +737 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm.h +833 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm_version.h.in +7 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark.c +55 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.c +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.h +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/commonmark.c +514 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/config.h.in +76 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/entities.inc +2138 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini.h +57 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_href_e.c +100 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_e.c +66 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_u.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.c +502 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.c +1788 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.h +29 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.c +159 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/latex.c +468 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/libcmark-gfm.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/linked_list.c +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/main.c +328 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/man.c +274 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.c +129 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.h +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.c +1045 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.h +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/parser.h +59 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plaintext.c +218 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.c +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.c +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.c +213 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.h +62 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.c +14056 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.h +70 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.re +365 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.c +317 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/xml.c +182 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/suppressions +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/CMakeLists.txt +114 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/afl_test_cases/test.md +49 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark-fuzz.c +58 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark.py +105 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/entity_tests.py +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-full-info-string.txt +0 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-table-prefer-style-attributes.txt +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions.txt +920 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/fuzzing_dictionary +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/normalize.py +194 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/pathological_tests.py +160 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/regression.txt +375 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/roundtrip_tests.py +50 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/run-cmark-fuzz +4 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/smart_punct.txt +177 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec.txt +10212 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec_tests.py +152 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/toolchain-mingw32.cmake +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/Dockerfile +41 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/appveyor-build.bat +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/make_entities_inc.py +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/mkcasefold.pl +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md.xsl +319 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md_gfm.xsl +80 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/why-cmark-and-not-x.md +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.js +6 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.py +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rb +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rkt +208 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper_ext.py +109 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/CMakeLists.txt +160 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Changes +372 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/License +20 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Makefile.am +51 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/ReadMe.md +46 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/announcement.msg +89 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/bootstrap +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/cmake/config.h.in +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/configure.ac +73 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/doc/doxygen.cfg +222 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/README.mkd +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/alpine-3.7 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/fedora-25 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-14.04 +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-16.04 +24 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/anchors.yaml +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/array.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/global-tag.yaml +14 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/json.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/mapping.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/numbers.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/strings.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/tags.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/yaml-version.yaml +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/Makefile.am +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/yaml.h +1999 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/ReadMe.md +77 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/Dockerfile +32 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/output/ReadMe +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/scripts/libyaml-dist.sh +23 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/regression-inputs/clusterfuzz-testcase-minimized-5607885063061504.yml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/Makefile.am +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/api.c +1393 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/dumper.c +394 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/emitter.c +2358 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/loader.c +544 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/parser.c +1416 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/reader.c +469 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/scanner.c +3598 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/writer.c +141 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/yaml_private.h +684 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/CMakeLists.txt +27 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/Makefile.am +9 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/ReadMe.md +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor-alt.c +800 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor.c +1127 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter-alt.c +217 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter.c +202 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-all-tests.sh +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-dumper.c +314 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter-test-suite.c +290 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter.c +327 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-loader.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser-test-suite.c +196 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser.c +88 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-scanner.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-reader.c +354 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-version.c +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yaml-0.1.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yamlConfig.cmake.in +16 -0
- data/ext/apex_ext/extconf.rb +103 -0
- data/lib/apex/configurable.rb +46 -0
- data/lib/apex/document.rb +66 -0
- data/lib/apex/version.rb +15 -0
- data/lib/apex.rb +28 -0
- metadata +544 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insert Extension
|
|
3
|
+
* Converts ++text++ to <ins>text</ins>
|
|
4
|
+
* Supports IAL attributes: ++text++{: .class} → <ins markdown="span" class="class">text</ins>
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#include "insert.h"
|
|
8
|
+
#include "ial.h" /* For parse_ial_content and attributes_to_html */
|
|
9
|
+
#include <string.h>
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
#include <stdbool.h>
|
|
12
|
+
#include <ctype.h>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Find IAL pattern after text
|
|
16
|
+
* Returns pointer to IAL start, or NULL if not found
|
|
17
|
+
* Sets ial_end to end of IAL pattern
|
|
18
|
+
*/
|
|
19
|
+
static const char *find_ial_after(const char *text, const char **ial_end) {
|
|
20
|
+
const char *p = text;
|
|
21
|
+
|
|
22
|
+
/* Skip whitespace */
|
|
23
|
+
while (*p && (*p == ' ' || *p == '\t')) {
|
|
24
|
+
p++;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Check for IAL pattern { ... } */
|
|
28
|
+
if (*p == '{') {
|
|
29
|
+
const char *start = p;
|
|
30
|
+
p++;
|
|
31
|
+
|
|
32
|
+
/* Find closing } */
|
|
33
|
+
const char *close = strchr(p, '}');
|
|
34
|
+
if (close) {
|
|
35
|
+
*ial_end = close + 1;
|
|
36
|
+
return start;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return NULL;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Process ++insert++ syntax as preprocessing
|
|
45
|
+
* Converts to <ins>text</ins> before parsing
|
|
46
|
+
* If followed by IAL, converts to <ins markdown="span" ...>text</ins>
|
|
47
|
+
*/
|
|
48
|
+
char *apex_process_inserts(const char *text) {
|
|
49
|
+
if (!text) return NULL;
|
|
50
|
+
|
|
51
|
+
size_t len = strlen(text);
|
|
52
|
+
size_t capacity = len * 2; /* Room for <ins> tags */
|
|
53
|
+
char *output = malloc(capacity);
|
|
54
|
+
if (!output) return NULL;
|
|
55
|
+
|
|
56
|
+
const char *read = text;
|
|
57
|
+
char *write = output;
|
|
58
|
+
size_t remaining = capacity;
|
|
59
|
+
|
|
60
|
+
bool in_code_block = false;
|
|
61
|
+
bool in_inline_code = false;
|
|
62
|
+
|
|
63
|
+
while (*read) {
|
|
64
|
+
/* Track code blocks (skip processing inside them) */
|
|
65
|
+
if (*read == '`') {
|
|
66
|
+
if (read[1] == '`' && read[2] == '`') {
|
|
67
|
+
in_code_block = !in_code_block;
|
|
68
|
+
} else if (!in_code_block) {
|
|
69
|
+
in_inline_code = !in_inline_code;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Look for ++insert++ (not in code, not Critic Markup) */
|
|
74
|
+
/* Skip if preceded by { (Critic Markup) */
|
|
75
|
+
bool is_critic = (read > text && read[-1] == '{');
|
|
76
|
+
|
|
77
|
+
/* Check opening ++ requirements:
|
|
78
|
+
* - Exactly 2 + characters: read[0] == '+' && read[1] == '+'
|
|
79
|
+
* - Not preceded by + or { (or beginning of line)
|
|
80
|
+
* - Character after ++ is not + or }
|
|
81
|
+
* - Character after ++ is not whitespace or newline
|
|
82
|
+
*/
|
|
83
|
+
bool preceded_by_plus = (read > text && read[-1] == '+');
|
|
84
|
+
bool preceded_by_brace = (read > text && read[-1] == '{');
|
|
85
|
+
bool followed_by_plus = (read[2] == '+');
|
|
86
|
+
bool followed_by_brace = (read[2] == '}');
|
|
87
|
+
bool is_valid_insert_start = (read[0] == '+' && read[1] == '+' &&
|
|
88
|
+
read[2] != '+' && !followed_by_brace &&
|
|
89
|
+
read[2] != '\0' && read[2] != '\n' &&
|
|
90
|
+
read[2] != '\r' && read[2] != ' ' && read[2] != '\t' &&
|
|
91
|
+
!preceded_by_plus && !preceded_by_brace && !followed_by_plus);
|
|
92
|
+
|
|
93
|
+
if (!in_code_block && !in_inline_code && !is_critic && is_valid_insert_start) {
|
|
94
|
+
|
|
95
|
+
/* Find closing ++ */
|
|
96
|
+
const char *close = read + 2;
|
|
97
|
+
while (*close && *close != '\n' && *close != '\r') {
|
|
98
|
+
if (close[0] == '+' && close[1] == '+') {
|
|
99
|
+
/* Check closing ++ requirements:
|
|
100
|
+
* - Character after closing ++ is not +
|
|
101
|
+
* - Character before closing ++ is not space
|
|
102
|
+
* - Character immediately before or after closing ++ is not +
|
|
103
|
+
*/
|
|
104
|
+
bool closing_followed_by_plus = (close[2] == '+');
|
|
105
|
+
bool closing_preceded_by_space = (close > read + 2 && (close[-1] == ' ' || close[-1] == '\t'));
|
|
106
|
+
bool closing_preceded_by_plus = (close > read + 2 && close[-1] == '+');
|
|
107
|
+
|
|
108
|
+
if (!closing_followed_by_plus && !closing_preceded_by_space &&
|
|
109
|
+
!closing_preceded_by_plus) {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
close++;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (*close && close[0] == '+' && close[1] == '+' && close[2] != '+') {
|
|
117
|
+
/* Found complete ++insert++ */
|
|
118
|
+
size_t content_len = close - (read + 2);
|
|
119
|
+
|
|
120
|
+
/* Ensure there's actual content (not just ++ on a line by itself) */
|
|
121
|
+
if (content_len > 0) {
|
|
122
|
+
const char *after_close = close + 2;
|
|
123
|
+
const char *ial_end = NULL;
|
|
124
|
+
const char *ial_start = find_ial_after(after_close, &ial_end);
|
|
125
|
+
|
|
126
|
+
if (ial_start) {
|
|
127
|
+
/* Has IAL - convert to <ins markdown="span" ...>text</ins> */
|
|
128
|
+
size_t ial_len = (ial_end - 1) - (ial_start + 1); /* Content inside {} */
|
|
129
|
+
|
|
130
|
+
/* Parse IAL attributes */
|
|
131
|
+
apex_attributes *attrs = parse_ial_content(ial_start + 1, ial_len);
|
|
132
|
+
|
|
133
|
+
if (attrs) {
|
|
134
|
+
/* Build ins tag with attributes */
|
|
135
|
+
char *attr_str = attributes_to_html(attrs);
|
|
136
|
+
if (attr_str) {
|
|
137
|
+
/* Calculate space needed */
|
|
138
|
+
size_t ins_open_len = 30 + strlen(attr_str) + content_len + 20;
|
|
139
|
+
if (remaining < ins_open_len) {
|
|
140
|
+
size_t written = write - output;
|
|
141
|
+
capacity = (written + ins_open_len + 1) * 2;
|
|
142
|
+
char *new_output = realloc(output, capacity);
|
|
143
|
+
if (!new_output) {
|
|
144
|
+
free(attr_str);
|
|
145
|
+
apex_free_attributes(attrs);
|
|
146
|
+
goto cleanup;
|
|
147
|
+
}
|
|
148
|
+
output = new_output;
|
|
149
|
+
write = output + written;
|
|
150
|
+
remaining = capacity - written;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Write <ins markdown="span" ...> */
|
|
154
|
+
int written = snprintf(write, remaining, "<ins markdown=\"span\"%s>", attr_str);
|
|
155
|
+
if (written > 0) {
|
|
156
|
+
if ((size_t)written >= remaining) {
|
|
157
|
+
/* String was truncated - need more space */
|
|
158
|
+
size_t current_written = write - output;
|
|
159
|
+
capacity = (current_written + written + 1) * 2;
|
|
160
|
+
char *new_output = realloc(output, capacity);
|
|
161
|
+
if (!new_output) {
|
|
162
|
+
free(attr_str);
|
|
163
|
+
apex_free_attributes(attrs);
|
|
164
|
+
goto cleanup;
|
|
165
|
+
}
|
|
166
|
+
output = new_output;
|
|
167
|
+
write = output + current_written;
|
|
168
|
+
remaining = capacity - current_written;
|
|
169
|
+
/* Retry with more space */
|
|
170
|
+
written = snprintf(write, remaining, "<ins markdown=\"span\"%s>", attr_str);
|
|
171
|
+
}
|
|
172
|
+
if (written > 0 && (size_t)written < remaining) {
|
|
173
|
+
write += written;
|
|
174
|
+
remaining -= written;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Write the content */
|
|
179
|
+
if (content_len < remaining) {
|
|
180
|
+
memcpy(write, read + 2, content_len);
|
|
181
|
+
write += content_len;
|
|
182
|
+
remaining -= content_len;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Write </ins> */
|
|
186
|
+
const char *close_tag = "</ins>";
|
|
187
|
+
size_t tag_len = strlen(close_tag);
|
|
188
|
+
if (tag_len < remaining) {
|
|
189
|
+
memcpy(write, close_tag, tag_len);
|
|
190
|
+
write += tag_len;
|
|
191
|
+
remaining -= tag_len;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Skip past the closing ++ and IAL */
|
|
195
|
+
read = ial_end;
|
|
196
|
+
free(attr_str);
|
|
197
|
+
apex_free_attributes(attrs);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
apex_free_attributes(attrs);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* No IAL - write simple <ins>text</ins> */
|
|
205
|
+
const char *open_tag = "<ins>";
|
|
206
|
+
size_t tag_len = strlen(open_tag);
|
|
207
|
+
if (tag_len < remaining) {
|
|
208
|
+
memcpy(write, open_tag, tag_len);
|
|
209
|
+
write += tag_len;
|
|
210
|
+
remaining -= tag_len;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Copy inserted content */
|
|
214
|
+
if (content_len < remaining) {
|
|
215
|
+
memcpy(write, read + 2, content_len);
|
|
216
|
+
write += content_len;
|
|
217
|
+
remaining -= content_len;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Write </ins> */
|
|
221
|
+
const char *close_tag = "</ins>";
|
|
222
|
+
tag_len = strlen(close_tag);
|
|
223
|
+
if (tag_len < remaining) {
|
|
224
|
+
memcpy(write, close_tag, tag_len);
|
|
225
|
+
write += tag_len;
|
|
226
|
+
remaining -= tag_len;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Skip past the closing ++ */
|
|
230
|
+
read = close + 2;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Copy character */
|
|
237
|
+
if (remaining > 0) {
|
|
238
|
+
*write++ = *read++;
|
|
239
|
+
remaining--;
|
|
240
|
+
} else {
|
|
241
|
+
read++;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
cleanup:
|
|
246
|
+
*write = '\0';
|
|
247
|
+
return output;
|
|
248
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Insert Extension
|
|
3
|
+
* Handles ++text++ syntax (converts to <ins>text</ins>)
|
|
4
|
+
* Supports IAL attributes: ++text++{: .class} → <ins markdown="span" class="class">text</ins>
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef APEX_INSERT_H
|
|
8
|
+
#define APEX_INSERT_H
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Process ++insert++ syntax in text
|
|
12
|
+
* Converts ++text++ to <ins>text</ins>
|
|
13
|
+
* If followed by IAL, converts to <ins markdown="span" ...>text</ins>
|
|
14
|
+
* Does not interfere with CriticMarkup {++text++} syntax
|
|
15
|
+
*/
|
|
16
|
+
char *apex_process_inserts(const char *text);
|
|
17
|
+
|
|
18
|
+
#endif
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math Extension for Apex
|
|
3
|
+
*
|
|
4
|
+
* Simple implementation that detects math delimiters and outputs HTML
|
|
5
|
+
* for MathJax/KaTeX to process on the client side.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "math.h"
|
|
9
|
+
#include <string.h>
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
#include <stdbool.h>
|
|
12
|
+
|
|
13
|
+
#include "parser.h"
|
|
14
|
+
#include "inlines.h"
|
|
15
|
+
#include "html.h"
|
|
16
|
+
|
|
17
|
+
/* Node type for math */
|
|
18
|
+
extern cmark_node_type APEX_NODE_MATH;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Scan for $...$ inline math
|
|
22
|
+
* Returns length if found, 0 otherwise
|
|
23
|
+
*
|
|
24
|
+
* Rules to avoid false positives:
|
|
25
|
+
* - Must have non-whitespace after opening $
|
|
26
|
+
* - Must have non-whitespace before closing $
|
|
27
|
+
* - No spaces immediately inside the delimiters
|
|
28
|
+
*/
|
|
29
|
+
static int scan_dollar_math(const char *input, int len, bool *is_display) {
|
|
30
|
+
if (len < 3) return 0;
|
|
31
|
+
|
|
32
|
+
/* Check for $$ (display math) */
|
|
33
|
+
if (input[0] == '$' && input[1] == '$') {
|
|
34
|
+
*is_display = true;
|
|
35
|
+
/* Find closing $$ */
|
|
36
|
+
for (int i = 2; i < len - 1; i++) {
|
|
37
|
+
if (input[i] == '$' && input[i + 1] == '$') {
|
|
38
|
+
return i + 2;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Check for single $ (inline math) */
|
|
45
|
+
if (input[0] == '$') {
|
|
46
|
+
*is_display = false;
|
|
47
|
+
|
|
48
|
+
/* Next character must not be whitespace or $ (avoid false positives like "$5 and $10") */
|
|
49
|
+
if (len < 2 || input[1] == ' ' || input[1] == '\t' || input[1] == '\n' || input[1] == '$') {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Find closing $ */
|
|
54
|
+
for (int i = 1; i < len; i++) {
|
|
55
|
+
if (input[i] == '$') {
|
|
56
|
+
/* Make sure it's not escaped */
|
|
57
|
+
if (i > 0 && input[i - 1] == '\\') continue;
|
|
58
|
+
|
|
59
|
+
/* Previous character should not be whitespace (avoid "$5 " matching) */
|
|
60
|
+
if (i > 1 && (input[i - 1] == ' ' || input[i - 1] == '\t' || input[i - 1] == '\n')) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Must have at least one character of content */
|
|
65
|
+
if (i == 1) return 0;
|
|
66
|
+
|
|
67
|
+
return i + 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Scan for \(...\) or \[...\] LaTeX-style math
|
|
77
|
+
* Returns length if found, 0 otherwise
|
|
78
|
+
*/
|
|
79
|
+
static int scan_latex_math(const char *input, int len, bool *is_display) {
|
|
80
|
+
if (len < 4) return 0;
|
|
81
|
+
|
|
82
|
+
/* Check for \[ (display math) */
|
|
83
|
+
if (input[0] == '\\' && input[1] == '[') {
|
|
84
|
+
*is_display = true;
|
|
85
|
+
/* Find closing \] */
|
|
86
|
+
for (int i = 2; i < len - 1; i++) {
|
|
87
|
+
if (input[i] == '\\' && input[i + 1] == ']') {
|
|
88
|
+
return i + 2;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Check for \( (inline math) */
|
|
95
|
+
if (input[0] == '\\' && input[1] == '(') {
|
|
96
|
+
*is_display = false;
|
|
97
|
+
/* Find closing \) */
|
|
98
|
+
for (int i = 2; i < len - 1; i++) {
|
|
99
|
+
if (input[i] == '\\' && input[i + 1] == ')') {
|
|
100
|
+
/* Validate: math content should have at least one valid math character */
|
|
101
|
+
/* Math should contain letters, numbers, or common math operators */
|
|
102
|
+
/* Reject if content is empty or only contains non-math special characters */
|
|
103
|
+
int content_len = i - 2;
|
|
104
|
+
if (content_len <= 0) {
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
bool has_math_content = false;
|
|
109
|
+
for (int j = 2; j < i; j++) {
|
|
110
|
+
unsigned char c = (unsigned char)input[j];
|
|
111
|
+
/* Allow letters, numbers, common math operators, and whitespace */
|
|
112
|
+
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
|
113
|
+
(c >= '0' && c <= '9') || c == '+' || c == '-' || c == '*' ||
|
|
114
|
+
c == '/' || c == '=' || c == '^' || c == '_' || c == ' ' ||
|
|
115
|
+
c == '.' || c == ',' || c == '(' || c == ')' || c == '\\') {
|
|
116
|
+
has_math_content = true;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/* If no valid math content found, don't treat as math */
|
|
121
|
+
if (!has_math_content) {
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
return i + 2;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Match function for $ character
|
|
134
|
+
*/
|
|
135
|
+
static cmark_node *match_math_dollar(cmark_syntax_extension *self,
|
|
136
|
+
cmark_parser *parser,
|
|
137
|
+
cmark_node *parent,
|
|
138
|
+
unsigned char character,
|
|
139
|
+
cmark_inline_parser *inline_parser) {
|
|
140
|
+
(void)self;
|
|
141
|
+
(void)parent;
|
|
142
|
+
if (character != '$') return NULL;
|
|
143
|
+
|
|
144
|
+
/* Get current position and remaining input */
|
|
145
|
+
int pos = cmark_inline_parser_get_offset(inline_parser);
|
|
146
|
+
cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
|
|
147
|
+
|
|
148
|
+
if (pos >= chunk->len) return NULL;
|
|
149
|
+
|
|
150
|
+
const char *input = (const char *)chunk->data + pos;
|
|
151
|
+
int remaining = chunk->len - pos;
|
|
152
|
+
|
|
153
|
+
/* Check for math */
|
|
154
|
+
bool is_display = false;
|
|
155
|
+
int consumed = scan_dollar_math(input, remaining, &is_display);
|
|
156
|
+
if (consumed == 0) return NULL;
|
|
157
|
+
|
|
158
|
+
/* Extract math content */
|
|
159
|
+
int start_offset = is_display ? 2 : 1;
|
|
160
|
+
int end_offset = is_display ? 2 : 1;
|
|
161
|
+
int content_len = consumed - start_offset - end_offset;
|
|
162
|
+
|
|
163
|
+
if (content_len <= 0) return NULL;
|
|
164
|
+
|
|
165
|
+
/* Create HTML inline node with appropriate class */
|
|
166
|
+
cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_HTML_INLINE, parser->mem);
|
|
167
|
+
|
|
168
|
+
/* Build HTML string */
|
|
169
|
+
char *html = malloc(content_len + 100);
|
|
170
|
+
if (!html) return NULL;
|
|
171
|
+
|
|
172
|
+
if (is_display) {
|
|
173
|
+
snprintf(html, content_len + 100,
|
|
174
|
+
"<span class=\"math display\">\\[%.*s\\]</span>",
|
|
175
|
+
content_len, input + start_offset);
|
|
176
|
+
} else {
|
|
177
|
+
snprintf(html, content_len + 100,
|
|
178
|
+
"<span class=\"math inline\">\\(%.*s\\)</span>",
|
|
179
|
+
content_len, input + start_offset);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
cmark_node_set_literal(node, html);
|
|
183
|
+
free(html);
|
|
184
|
+
|
|
185
|
+
/* Set line/column info */
|
|
186
|
+
node->start_line = node->end_line = cmark_inline_parser_get_line(inline_parser);
|
|
187
|
+
node->start_column = cmark_inline_parser_get_column(inline_parser) - 1;
|
|
188
|
+
node->end_column = cmark_inline_parser_get_column(inline_parser) + consumed - 1;
|
|
189
|
+
|
|
190
|
+
/* Advance parser */
|
|
191
|
+
cmark_inline_parser_set_offset(inline_parser, pos + consumed);
|
|
192
|
+
|
|
193
|
+
return node;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Match function for \ character (LaTeX style)
|
|
198
|
+
*/
|
|
199
|
+
__attribute__((unused))
|
|
200
|
+
static cmark_node *match_math_backslash(cmark_syntax_extension *self,
|
|
201
|
+
cmark_parser *parser,
|
|
202
|
+
cmark_node *parent,
|
|
203
|
+
unsigned char character,
|
|
204
|
+
cmark_inline_parser *inline_parser) {
|
|
205
|
+
(void)self;
|
|
206
|
+
(void)parent;
|
|
207
|
+
if (character != '\\') return NULL;
|
|
208
|
+
|
|
209
|
+
/* Get current position and remaining input */
|
|
210
|
+
int pos = cmark_inline_parser_get_offset(inline_parser);
|
|
211
|
+
cmark_chunk *chunk = cmark_inline_parser_get_chunk(inline_parser);
|
|
212
|
+
|
|
213
|
+
if (pos >= chunk->len) return NULL;
|
|
214
|
+
|
|
215
|
+
const char *input = (const char *)chunk->data + pos;
|
|
216
|
+
int remaining = chunk->len - pos;
|
|
217
|
+
|
|
218
|
+
/* Check for math */
|
|
219
|
+
bool is_display = false;
|
|
220
|
+
int consumed = scan_latex_math(input, remaining, &is_display);
|
|
221
|
+
if (consumed == 0) return NULL;
|
|
222
|
+
|
|
223
|
+
/* Extract math content */
|
|
224
|
+
int start_offset = 2; /* Skip \( or \[ */
|
|
225
|
+
int end_offset = 2; /* Skip \) or \] */
|
|
226
|
+
int content_len = consumed - start_offset - end_offset;
|
|
227
|
+
|
|
228
|
+
if (content_len <= 0) return NULL;
|
|
229
|
+
|
|
230
|
+
/* Create HTML inline node */
|
|
231
|
+
cmark_node *node = cmark_node_new_with_mem(CMARK_NODE_HTML_INLINE, parser->mem);
|
|
232
|
+
|
|
233
|
+
/* Build HTML string */
|
|
234
|
+
char *html = malloc(content_len + 100);
|
|
235
|
+
if (!html) return NULL;
|
|
236
|
+
|
|
237
|
+
if (is_display) {
|
|
238
|
+
snprintf(html, content_len + 100,
|
|
239
|
+
"<span class=\"math display\">\\[%.*s\\]</span>",
|
|
240
|
+
content_len, input + start_offset);
|
|
241
|
+
} else {
|
|
242
|
+
snprintf(html, content_len + 100,
|
|
243
|
+
"<span class=\"math inline\">\\(%.*s\\)</span>",
|
|
244
|
+
content_len, input + start_offset);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
cmark_node_set_literal(node, html);
|
|
248
|
+
free(html);
|
|
249
|
+
|
|
250
|
+
/* Set line/column info */
|
|
251
|
+
node->start_line = node->end_line = cmark_inline_parser_get_line(inline_parser);
|
|
252
|
+
node->start_column = cmark_inline_parser_get_column(inline_parser) - 1;
|
|
253
|
+
node->end_column = cmark_inline_parser_get_column(inline_parser) + consumed - 1;
|
|
254
|
+
|
|
255
|
+
/* Advance parser */
|
|
256
|
+
cmark_inline_parser_set_offset(inline_parser, pos + consumed);
|
|
257
|
+
|
|
258
|
+
return node;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Create the math extension
|
|
263
|
+
*/
|
|
264
|
+
cmark_syntax_extension *create_math_extension(void) {
|
|
265
|
+
cmark_syntax_extension *ext = cmark_syntax_extension_new("math");
|
|
266
|
+
|
|
267
|
+
/* Register special characters $ and \ */
|
|
268
|
+
cmark_llist *special_chars = NULL;
|
|
269
|
+
cmark_mem *mem = cmark_get_default_mem_allocator();
|
|
270
|
+
special_chars = cmark_llist_append(mem, special_chars, (void *)'$');
|
|
271
|
+
special_chars = cmark_llist_append(mem, special_chars, (void *)'\\');
|
|
272
|
+
cmark_syntax_extension_set_special_inline_chars(ext, special_chars);
|
|
273
|
+
|
|
274
|
+
/* Set match function - it will handle both $ and \ */
|
|
275
|
+
cmark_syntax_extension_set_match_inline_func(ext, match_math_dollar);
|
|
276
|
+
|
|
277
|
+
return ext;
|
|
278
|
+
}
|
|
279
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math Extension for Apex
|
|
3
|
+
*
|
|
4
|
+
* Detects and preserves LaTeX math for client-side rendering:
|
|
5
|
+
* $inline math$
|
|
6
|
+
* $$display math$$
|
|
7
|
+
* \(inline\)
|
|
8
|
+
* \[display\]
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef APEX_MATH_H
|
|
12
|
+
#define APEX_MATH_H
|
|
13
|
+
|
|
14
|
+
#include <stdbool.h>
|
|
15
|
+
#include "cmark-gfm.h"
|
|
16
|
+
#include "cmark-gfm-extension_api.h"
|
|
17
|
+
|
|
18
|
+
#ifdef __cplusplus
|
|
19
|
+
extern "C" {
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create and return the math extension
|
|
24
|
+
*/
|
|
25
|
+
cmark_syntax_extension *create_math_extension(void);
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
}
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#endif /* APEX_MATH_H */
|
|
32
|
+
|