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 @@ -49,6 +49,8 @@ enum State {
private String currentSectionTitle;
private StringBuilder currentMarkdown;

private String linkUrl;

public MarkdownGeneratorParserHandler() {
this.sections = new ArrayList<>();

Expand Down Expand Up @@ -267,11 +269,17 @@ public void onSectionEnd() {
@Override
public void onLinkStart(String url) {
currentMarkdown.append("[");
linkUrl = url;
}

@Override
public void onLinkEnd() {
currentMarkdown.append("]()");
currentMarkdown.append("](");
if (linkUrl != null) {
currentMarkdown.append(linkUrl);
linkUrl = null;
}
currentMarkdown.append(")");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class MarkdownGeneratorParserHandlerTest {
result.should == "```java\nSystem.out.println();\n```\n\n"
}

@Test
void "should generate links"() {
def result = pageMarkdownAsText("[*hello* world](https://example.com)")
result.should == "[*hello* world](https://example.com)\n\n"
}

@Test
void "should generate lists"() {
def result = pageMarkdownAsText("- Item one\n- Item two")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix: `llm.txt` correctly renders links