mod(node2buffer): correctly display and link hyper links
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 31s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 31s
This commit is contained in:
@@ -51,8 +51,8 @@ pub fn toBuffer(
|
|||||||
const content = value: {
|
const content = value: {
|
||||||
switch (node.token.element.type) {
|
switch (node.token.element.type) {
|
||||||
.text => break :value input[node.token.start..node.token.end],
|
.text => break :value input[node.token.start..node.token.end],
|
||||||
|
.link => break :value input[node.token.start + 1 .. node.token.start + 1 + node.title.?.len],
|
||||||
// TODO: use corresponding link contents to create 'real' links using escape sequences
|
// TODO: use corresponding link contents to create 'real' links using escape sequences
|
||||||
.link => break :value input[node.token.start .. node.token.start + node.href.?.len + node.title.?.len + 4],
|
|
||||||
.bold_close, .italic_close, .block_close, .code_close, .title_close, .href_close => {
|
.bold_close, .italic_close, .block_close, .code_close, .title_close, .href_close => {
|
||||||
if (next_start) |s| {
|
if (next_start) |s| {
|
||||||
next_start = null;
|
next_start = null;
|
||||||
@@ -127,6 +127,17 @@ pub fn toBuffer(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
.link => {
|
||||||
|
style.ul_style = .single;
|
||||||
|
const uri = input[node.token.start + 1 + node.title.?.len + 2 .. node.token.start + 1 + node.title.?.len + 2 + node.href.?.len];
|
||||||
|
for (content, 0..) |_, i| {
|
||||||
|
try array.append(.{
|
||||||
|
.link = .{ .uri = uri },
|
||||||
|
.char = .{ .grapheme = content[i .. i + 1] },
|
||||||
|
.style = style,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
else => {
|
else => {
|
||||||
for (content, 0..) |_, i| {
|
for (content, 0..) |_, i| {
|
||||||
try array.append(.{
|
try array.append(.{
|
||||||
|
|||||||
Reference in New Issue
Block a user