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 @@ -382,12 +382,13 @@ private static int[] CalculateColumnWidths(LlmMarkdownRenderer renderer, Table t
private static string RenderTableCellContent(LlmMarkdownRenderer renderer, TableCell cell) =>
DocumentationObjectPoolProvider.UseLlmMarkdownRenderer(
renderer.BuildContext,
cell.Descendants().OfType<Inline>(),
static (tmpRenderer, obj) =>
cell,
static (tmpRenderer, c) =>
{
foreach (var inline in obj)
tmpRenderer.Write(inline);
});
// Render the cell's child blocks (e.g., ParagraphBlock) which properly
// handles the inline hierarchy without duplicating nested inline content
tmpRenderer.WriteChildren(c);
}).Trim();
}

public class LlmDirectiveRenderer : MarkdownObjectRenderer<LlmMarkdownRenderer, DirectiveBlock>
Expand Down
110 changes: 110 additions & 0 deletions tests/authoring/LlmMarkdown/LlmMarkdownOutput.fs
Original file line number Diff line number Diff line change
Expand Up @@ -641,3 +641,113 @@ Another setting description.

An advanced option.
"""

type ``links in paragraphs`` () =
static let markdown = Setup.Document """
This is a paragraph with a [link to docs](https://www.elastic.co/docs/deploy-manage/security) in it.
"""

[<Fact>]
let ``renders links without duplication`` () =
markdown |> convertsToNewLLM """This is a paragraph with a [link to docs](https://www.elastic.co/docs/deploy-manage/security) in it.
"""

type ``links in tables`` () =
static let markdown = Setup.Document """
| Feature | Availability |
|---------|--------------|
| [Security configurations](https://www.elastic.co/docs/deploy-manage/security) | Full control |
| [Authentication realms](https://www.elastic.co/docs/deploy-manage/users-roles) | Available |
"""

[<Fact>]
let ``renders links in table cells without duplication`` () =
markdown |> convertsToNewLLM """
| Feature | Availability |
|--------------------------------------------------------------------------------|--------------|
| [Security configurations](https://www.elastic.co/docs/deploy-manage/security) | Full control |
| [Authentication realms](https://www.elastic.co/docs/deploy-manage/users-roles) | Available |
"""

type ``multiple links in table cells`` () =
static let markdown = Setup.Document """
| Feature | Links |
|---------|-------|
| Security | [Config](https://example.com/config) and [Auth](https://example.com/auth) |
"""

[<Fact>]
let ``renders multiple links in same cell without duplication`` () =
markdown |> convertsToNewLLM """
| Feature | Links |
|----------|---------------------------------------------------------------------------|
| Security | [Config](https://example.com/config) and [Auth](https://example.com/auth) |
"""

type ``links with formatting in tables`` () =
static let markdown = Setup.Document """
| Feature | Description |
|---------|-------------|
| [**Bold link**](https://example.com) | Description |
| [*Italic link*](https://example.com/italic) | Another |
"""

[<Fact>]
let ``renders formatted links in table cells correctly`` () =
markdown |> convertsToNewLLM """
| Feature | Description |
|---------------------------------------------|-------------|
| [**Bold link**](https://example.com) | Description |
| [*Italic link*](https://example.com/italic) | Another |
"""

type ``bold and italic in tables`` () =
static let markdown = Setup.Document """
| Format | Example |
|--------|---------|
| Bold | This is **bold text** here |
| Italic | This is *italic text* here |
| Both | This is **bold** and *italic* |
"""

[<Fact>]
let ``renders bold and italic in table cells without duplication`` () =
markdown |> convertsToNewLLM """
| Format | Example |
|--------|-------------------------------|
| Bold | This is **bold text** here |
| Italic | This is *italic text* here |
| Both | This is **bold** and *italic* |
"""

type ``code inline in tables`` () =
static let markdown = Setup.Document """
| Command | Description |
|---------|-------------|
| `git status` | Shows status |
| `git commit` | Commits changes |
"""

[<Fact>]
let ``renders code inline in table cells correctly`` () =
markdown |> convertsToNewLLM """
| Command | Description |
|--------------|-----------------|
| `git status` | Shows status |
| `git commit` | Commits changes |
"""

type ``images in tables`` () =
static let markdown = Setup.Document """
| Icon | Name |
|------|------|
| ![logo](https://example.com/logo.png) | Logo |
"""

[<Fact>]
let ``renders images in table cells without duplication`` () =
markdown |> convertsToNewLLM """
| Icon | Name |
|---------------------------------------|------|
| ![logo](https://example.com/logo.png) | Logo |
"""
Loading