Skip to content

Commit 9cc0584

Browse files
committed
Add inlineCard
1 parent 157ce32 commit 9cc0584

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ print(markdown) -- Output: **Hello **World
5353
| mention | `@username` |
5454
| emoji | `:shortName:` |
5555
| status | Colored emoji + text (e.g., `🟢 DONE`) |
56+
| inlineCard | `[ISSUE-123](url)` (extracts Jira key) |
5657
| hardBreak | Two spaces + newline |
5758

5859
## Supported Marks

spec/adf2md_spec.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,20 @@ describe("adf2md", function()
504504
end)
505505
end)
506506

507+
describe("inlineCard", function()
508+
it("converts to markdown link", function()
509+
local doc = {
510+
type = "paragraph",
511+
content = {
512+
{ type = "text", text = "See " },
513+
{ type = "inlineCard", attrs = { url = "https://jira.example.com/browse/PROJ-123" } },
514+
},
515+
}
516+
local result = adf2md(doc)
517+
assert.are.equal("See [PROJ-123](https://jira.example.com/browse/PROJ-123)", result)
518+
end)
519+
end)
520+
507521
describe("unsupported type", function()
508522
it("shows marker for unknown node type", function()
509523
local doc = {

src/adf2md.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ node_handlers.emoji = function(node, convert_node)
6161
return node.attrs and node.attrs.shortName or ""
6262
end
6363

64+
node_handlers.inlineCard = function(node, convert_node)
65+
local url = node.attrs and node.attrs.url or ""
66+
local label = url:match("/browse/([^/]+)$") or url
67+
return "[" .. label .. "](" .. url .. ")"
68+
end
69+
6470
node_handlers.status = function(node, convert_node)
6571
local color_map = {
6672
blue = "🔵",

0 commit comments

Comments
 (0)