Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static ParsedFootnote parse(ComponentsRegistry componentsRegistry, Path m

var visitor = new MarkdownVisitor(componentsRegistry, markdownPath, new MarkdownParsingContext(), parserHandler);
visit(visitor, footnote);
parserHandler.onParsingEnd();

List<PageSearchEntry> searchEntries = searchHandler.getSearchEntries();
DocElement docElement = docElementsHandler.getDocElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,28 +288,12 @@ public void onSnippet(PluginParams pluginParams, String lang, String lineNumber,

@Override
public void onTable(MarkupTableData tableData) {
List<String> columnTitles = tableData.getColumnTitles();
List<List<Object>> data = tableData.getData();

if (columnTitles.isEmpty()) {
String markdownTable = tableData.toMarkdown();
if (markdownTable.isEmpty()) {
return;
}

currentMarkdown.append("| ").append(String.join(" | ", columnTitles)).append(" |\n");
currentMarkdown.append("|").append(" --- |".repeat(columnTitles.size())).append("\n");

for (List<Object> row : data) {
currentMarkdown.append("| ");
for (int i = 0; i < columnTitles.size(); i++) {
String cell = i < row.size() && row.get(i) != null ? row.get(i).toString() : "";
currentMarkdown.append(cell.replace("|", "\\|"));
if (i < columnTitles.size() - 1) {
currentMarkdown.append(" | ");
}
}
currentMarkdown.append(" |\n");
}
currentMarkdown.append("\n\n");
currentMarkdown.append(markdownTable).append("\n\n");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ public String allText() {
return String.join(" ", textParts);
}

public String toMarkdown() {
if (header.isEmpty()) {
return "";
}

StringBuilder markdown = new StringBuilder();
List<String> columnTitles = getColumnTitles();
markdown.append("| ").append(String.join(" | ", columnTitles)).append(" |\n");
markdown.append("|").append(" --- |".repeat(columnTitles.size())).append("\n");

for (List<Object> row : getData()) {
markdown.append("| ");
for (int i = 0; i < columnTitles.size(); i++) {
String cell = i < row.size() && row.get(i) != null ? row.get(i).toString() : "";
markdown.append(cell.replace("|", "\\|"));
if (i < columnTitles.size() - 1) {
markdown.append(" | ");
}
}
markdown.append(" |\n");
}

return markdown.toString().stripTrailing();
}

public MarkupTableData withColumnsInOrder(List<String> columnNames) {
List<Integer> newIdxOrder = findColumnIdxes(columnNames);

Expand All @@ -111,7 +136,7 @@ public MarkupTableData withoutRowsMatchingRegexp(List<String> regexpList) {
}

public MarkupTableData withRowsRegexpPredicate(List<String> regexpList, BiFunction<Row, Pattern, Boolean> predicate) {
List<Pattern> patternsList = regexpList.stream().map(Pattern::compile).collect(toList());
List<Pattern> patternsList = regexpList.stream().map(Pattern::compile).toList();
List<Row> newRows = data.stream()
.filter(row -> patternsList.stream().anyMatch(regexp -> predicate.apply(row, regexp)))
.collect(toList());
Expand Down
25 changes: 18 additions & 7 deletions znai-docs/znai/llm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ answer-link: znai-from-export/introduction/getting-started#command-line
## CLI download

Download and unzip
[znai](https://repo.maven.apache.org/maven2/org/testingisdocumenting/znai/znai-dist/1.91/znai-dist-1.91-znai.zip). Add
it to your `PATH`.
[znai](https://repo.maven.apache.org/maven2/org/testingisdocumenting/znai/znai-dist/1.92-SNAPSHOT/znai-dist-1.92-SNAPSHOT-znai.zip).
Add it to your `PATH`.

## Brew

Expand All @@ -162,7 +162,7 @@ answer-link: znai-from-export/introduction/getting-started#maven-plugin
<plugin>
<groupId>org.testingisdocumenting.znai</groupId>
<artifactId>znai-maven-plugin</artifactId>
<version>1.91</version>
<version>1.92-SNAPSHOT</version>
</plugin>
```

Expand Down Expand Up @@ -910,7 +910,7 @@ To define a footnote use

To add a reference to the footnote use `[^my-id]` which will result in [^my-id]

[^my-id]:
[^my-id]: extra content for my footnote goes here potentially including code blocks Constructor

Note: numeric footnotes are treated as text footnotes, and they will be assigned the auto incremented number in order of
appearance.
Expand Down Expand Up @@ -938,7 +938,7 @@ answer-link: znai-from-export/flow/footnotes#footnotes-list
A footnotes list is automatically appended at the end of the page when footnotes are present. Clicking the number in the
list navigates back to the reference [^another-note].

[^another-note]:
[^another-note]: This is another footnote to demonstrate the list with multiple entries

To hide the footnotes list, set `hideFootnoteList` to `true` in `meta.json`:

Expand Down Expand Up @@ -4766,7 +4766,7 @@ package webtauexamples

import static org.testingisdocumenting.webtau.WebTauGroovyDsl.*

def homeSearchInput = $('input[class*="searchbox_input"], input[class*="search-input"]')
def homeSearchInput = $('textarea[class*="search-input"], input[class*="searchbox_input"], input[class*="search-input"]')
def resultSearchInput = $("#search_form_input")
def result = $('article[data-testid="result"]')

Expand Down Expand Up @@ -6945,6 +6945,12 @@ Account, Price, Description
```
```

| Account | Price | Description |
| --- | --- | --- |
| #12BGD3 | 100 | custom table with a long attachment |
| #12BGD3 | 150 | chair |
| #91AGB1 | 10 | lunch |

# Layout :: Tables :: Multiline Content
answer-link: znai-from-export/layout/tables#multiline-content

Expand Down Expand Up @@ -8978,7 +8984,7 @@ package webtauexamples

import static org.testingisdocumenting.webtau.WebTauGroovyDsl.*

def homeSearchInput = $('input[class*="searchbox_input"], input[class*="search-input"]')
def homeSearchInput = $('textarea[class*="search-input"], input[class*="searchbox_input"], input[class*="search-input"]')
def resultSearchInput = $("#search_form_input")
def result = $('article[data-testid="result"]')

Expand Down Expand Up @@ -10089,6 +10095,11 @@ export PATH=$(pwd)/dist:$PATH
znai --version
```

# Release Notes :: 2026 :: 1.92
answer-link: znai-from-export/release-notes/2026#192



# Release Notes :: 2026 :: 1.91
answer-link: znai-from-export/release-notes/2026#191

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fix: llm.txt no longer misses content from Table fence plugin
* Fix: llm.txt no longer misses content from footnotes
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ public PluginResult process(ComponentsRegistry componentsRegistry, Path markupPa
public List<SearchText> textForSearch() {
return List.of(SearchScore.STANDARD.text(docElementFromParams.getModifiedTable().allText()));
}

@Override
public String markdownRepresentation() {
return docElementFromParams.getModifiedTable().toMarkdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,55 @@ def hello():
"""
}

@Test
void "includes table fence block as markdown table"() {
def markdown = """# Table Section

```table
Account, Price, Description
#12BGD3, 100, custom table
#91AGB1, 150, chair
```
"""

def content = generateContent(markdown)

content.should == """[//]: # (this is an auto generated file)
"Test Guide" full guide:

# Chapter :: Page One :: Table Section
answer-link: https://example.com/test/chapter/page-one#table-section

| Account | Price | Description |
| --- | --- | --- |
| #12BGD3 | 100 | custom table |
| #91AGB1 | 150 | chair |
"""
}

@Test
void "includes footnotes"() {
def markdown = """# Footnote Section

Main text[^my-note] here.

[^my-note]: additional footnote text
"""

def content = generateContent(markdown)

content.should == """[//]: # (this is an auto generated file)
"Test Guide" full guide:

# Chapter :: Page One :: Footnote Section
answer-link: https://example.com/test/chapter/page-one#footnote-section

Main text[^my-note] here.

[^my-note]: additional footnote text
"""
}

private static String generateContent(String markdown) {
def docMeta = new DocMeta([id: "test", title: "Test Guide"])

Expand Down
Loading