apex-ruby 1.0.6 → 1.0.7
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/ext/apex_ext/apex_ext.c +6 -0
- data/ext/apex_ext/apex_src/AGENTS.md +41 -0
- data/ext/apex_ext/apex_src/CHANGELOG.md +412 -2
- data/ext/apex_ext/apex_src/CMakeLists.txt +41 -29
- data/ext/apex_ext/apex_src/Formula/apex.rb +2 -2
- data/ext/apex_ext/apex_src/Package.swift +9 -0
- data/ext/apex_ext/apex_src/README.md +31 -9
- data/ext/apex_ext/apex_src/ROADMAP.md +5 -0
- data/ext/apex_ext/apex_src/VERSION +1 -1
- data/ext/apex_ext/apex_src/cli/main.c +1125 -13
- data/ext/apex_ext/apex_src/docs/index.md +459 -0
- data/ext/apex_ext/apex_src/include/apex/apex.h +67 -5
- data/ext/apex_ext/apex_src/include/apex/ast_man.h +20 -0
- data/ext/apex_ext/apex_src/include/apex/ast_markdown.h +39 -0
- data/ext/apex_ext/apex_src/include/apex/ast_terminal.h +40 -0
- data/ext/apex_ext/apex_src/include/apex/module.modulemap +1 -1
- data/ext/apex_ext/apex_src/man/apex-config.5 +333 -258
- data/ext/apex_ext/apex_src/man/apex-config.5.md +3 -1
- data/ext/apex_ext/apex_src/man/apex-plugins.7 +401 -316
- data/ext/apex_ext/apex_src/man/apex.1 +663 -620
- data/ext/apex_ext/apex_src/man/apex.1.html +703 -0
- data/ext/apex_ext/apex_src/man/apex.1.md +160 -90
- data/ext/apex_ext/apex_src/objc/Apex.swift +6 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.h +12 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.m +9 -0
- data/ext/apex_ext/apex_src/pages/index.md +459 -0
- data/ext/apex_ext/apex_src/src/_README.md +4 -4
- data/ext/apex_ext/apex_src/src/apex.c +702 -44
- data/ext/apex_ext/apex_src/src/ast_json.c +1130 -0
- data/ext/apex_ext/apex_src/src/ast_json.h +46 -0
- data/ext/apex_ext/apex_src/src/ast_man.c +948 -0
- data/ext/apex_ext/apex_src/src/ast_markdown.c +409 -0
- data/ext/apex_ext/apex_src/src/ast_terminal.c +2516 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +8 -5
- data/ext/apex_ext/apex_src/src/extensions/definition_list.c +491 -1514
- data/ext/apex_ext/apex_src/src/extensions/definition_list.h +8 -15
- data/ext/apex_ext/apex_src/src/extensions/emoji.c +207 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.h +14 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.c +178 -71
- data/ext/apex_ext/apex_src/src/extensions/highlight.c +37 -5
- data/ext/apex_ext/apex_src/src/extensions/ial.c +416 -47
- data/ext/apex_ext/apex_src/src/extensions/includes.c +241 -10
- data/ext/apex_ext/apex_src/src/extensions/includes.h +1 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.c +166 -3
- data/ext/apex_ext/apex_src/src/extensions/metadata.h +7 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.c +34 -3
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +55 -10
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.h +7 -4
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +84 -52
- data/ext/apex_ext/apex_src/src/extensions/toc.c +133 -19
- data/ext/apex_ext/apex_src/src/filters_ast.c +194 -0
- data/ext/apex_ext/apex_src/src/filters_ast.h +36 -0
- data/ext/apex_ext/apex_src/src/html_renderer.c +1265 -35
- data/ext/apex_ext/apex_src/src/html_renderer.h +21 -0
- data/ext/apex_ext/apex_src/src/plugins_remote.c +40 -14
- data/ext/apex_ext/apex_src/tests/CMakeLists.txt +1 -0
- data/ext/apex_ext/apex_src/tests/README.md +11 -5
- data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +13 -2
- data/ext/apex_ext/apex_src/tests/fixtures/filters/filter_output_with_rawblock.json +1 -0
- data/ext/apex_ext/apex_src/tests/fixtures/filters/unwrap.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/auto-wildcard.md +8 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.avif +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.jpg +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu.webp +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.avif +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.jpg +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/img/app-pass-1-profile-menu@2x.webp +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/media_formats_test.md +63 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data-semi.csv +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/with space.txt +1 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/inline_tables_test.md +4 -1
- data/ext/apex_ext/apex_src/tests/paginate_cli_test.sh +64 -0
- data/ext/apex_ext/apex_src/tests/terminal_width_test.sh +29 -0
- data/ext/apex_ext/apex_src/tests/test-swift-package.sh +14 -0
- data/ext/apex_ext/apex_src/tests/test_cmark_callback.c +189 -0
- data/ext/apex_ext/apex_src/tests/test_extensions.c +374 -0
- data/ext/apex_ext/apex_src/tests/test_metadata.c +68 -0
- data/ext/apex_ext/apex_src/tests/test_output.c +291 -2
- data/ext/apex_ext/apex_src/tests/test_runner.c +10 -0
- data/ext/apex_ext/apex_src/tests/test_syntax_highlight.c +1 -1
- data/ext/apex_ext/apex_src/tests/test_tables.c +17 -1
- data/lib/apex/version.rb +1 -1
- metadata +32 -2
- data/ext/apex_ext/apex_src/docs/FUTURE_FEATURES.md +0 -456
|
@@ -7,6 +7,32 @@
|
|
|
7
7
|
#include <string.h>
|
|
8
8
|
#include <stdlib.h>
|
|
9
9
|
#include <stdbool.h>
|
|
10
|
+
#include <ctype.h>
|
|
11
|
+
|
|
12
|
+
/** True if content at p looks like a list marker (- , * , + , or digit+. ) */
|
|
13
|
+
static bool looks_like_list_marker(const char *p) {
|
|
14
|
+
if (*p == '-' || *p == '*' || *p == '+')
|
|
15
|
+
return (p[1] == ' ' || p[1] == '\t');
|
|
16
|
+
if (isdigit((unsigned char)*p)) {
|
|
17
|
+
while (isdigit((unsigned char)*p)) p++;
|
|
18
|
+
return (*p == '.' && (p[1] == ' ' || p[1] == '\t'));
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** True if we're at the start of a line that is an indented code block (4+ spaces or tab)
|
|
24
|
+
* and not a list line. List lines (nested or continuation) should still get highlight. */
|
|
25
|
+
static bool line_is_indented_code_block(const char *read) {
|
|
26
|
+
if (*read == '\t') {
|
|
27
|
+
return !looks_like_list_marker(read + 1);
|
|
28
|
+
}
|
|
29
|
+
if (read[0] != ' ' || read[1] != ' ' || read[2] != ' ' || read[3] != ' ')
|
|
30
|
+
return false;
|
|
31
|
+
const char *content = read + 4;
|
|
32
|
+
while (*content == ' ')
|
|
33
|
+
content++;
|
|
34
|
+
return !looks_like_list_marker(content);
|
|
35
|
+
}
|
|
10
36
|
|
|
11
37
|
/**
|
|
12
38
|
* Process ==highlight== syntax as preprocessing
|
|
@@ -26,9 +52,15 @@ char *apex_process_highlights(const char *text) {
|
|
|
26
52
|
|
|
27
53
|
bool in_code_block = false;
|
|
28
54
|
bool in_inline_code = false;
|
|
55
|
+
bool in_indented_code_block = false;
|
|
29
56
|
|
|
30
57
|
while (*read) {
|
|
31
|
-
/*
|
|
58
|
+
/* At line start: indented code block only if 4+ spaces/tab and not a list line */
|
|
59
|
+
if (read == text || read[-1] == '\n') {
|
|
60
|
+
in_indented_code_block = line_is_indented_code_block(read);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Track fenced and inline code (skip highlighting inside them) */
|
|
32
64
|
if (*read == '`') {
|
|
33
65
|
if (read[1] == '`' && read[2] == '`') {
|
|
34
66
|
in_code_block = !in_code_block;
|
|
@@ -40,7 +72,7 @@ char *apex_process_highlights(const char *text) {
|
|
|
40
72
|
/* Look for ==highlight== (not in code, not Critic Markup) */
|
|
41
73
|
/* Skip if preceded by { (Critic Markup) */
|
|
42
74
|
bool is_critic = (read > text && read[-1] == '{');
|
|
43
|
-
|
|
75
|
+
|
|
44
76
|
/* Check opening == requirements:
|
|
45
77
|
* - Exactly 2 = characters: read[0] == '=' && read[1] == '='
|
|
46
78
|
* - Not preceded by = or + (or beginning of line): (?<![=+])
|
|
@@ -57,7 +89,7 @@ char *apex_process_highlights(const char *text) {
|
|
|
57
89
|
read[2] != '\r' && read[2] != ' ' && read[2] != '\t' &&
|
|
58
90
|
!preceded_by_equals && !preceded_by_plus && !followed_by_plus);
|
|
59
91
|
|
|
60
|
-
if (!in_code_block && !in_inline_code && !is_critic && is_valid_highlight_start) {
|
|
92
|
+
if (!in_code_block && !in_inline_code && !in_indented_code_block && !is_critic && is_valid_highlight_start) {
|
|
61
93
|
|
|
62
94
|
/* Find closing == */
|
|
63
95
|
const char *close = read + 2;
|
|
@@ -72,8 +104,8 @@ char *apex_process_highlights(const char *text) {
|
|
|
72
104
|
bool closing_preceded_by_space = (close > read + 2 && (close[-1] == ' ' || close[-1] == '\t'));
|
|
73
105
|
bool closing_preceded_by_plus = (close > read + 2 && close[-1] == '+');
|
|
74
106
|
bool closing_followed_by_plus = (close[2] == '+');
|
|
75
|
-
|
|
76
|
-
if (!closing_followed_by_equals && !closing_preceded_by_space &&
|
|
107
|
+
|
|
108
|
+
if (!closing_followed_by_equals && !closing_preceded_by_space &&
|
|
77
109
|
!closing_preceded_by_plus && !closing_followed_by_plus) {
|
|
78
110
|
break;
|
|
79
111
|
}
|