mod: simplify minor implementation details
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 30s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 30s
Add scroll length detection, and link transformation with highlighting.
This commit is contained in:
@@ -14,7 +14,7 @@ pub fn toBuffer(
|
||||
var next_start: ?usize = start;
|
||||
var style = sty;
|
||||
// FIXME: support list display
|
||||
// TODO: improve code block listings (i.e. add line numbers with corresponding seperator, etc.)
|
||||
// TODO: improve code block listings (i.e. add line numbers with corresponding separator, etc.)
|
||||
|
||||
// determine general styling changes
|
||||
switch (node.token.element.type) {
|
||||
@@ -41,6 +41,9 @@ pub fn toBuffer(
|
||||
next_start = node.token.start;
|
||||
style.fg = .{ .index = 8 };
|
||||
},
|
||||
.link => {
|
||||
style.fg = .{ .index = 3 };
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
@@ -48,13 +51,12 @@ pub fn toBuffer(
|
||||
const content = value: {
|
||||
switch (node.token.element.type) {
|
||||
.text => break :value input[node.token.start..node.token.end],
|
||||
// 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 => {
|
||||
if (next_start) |s| {
|
||||
next_start = null;
|
||||
const e = node.token.end;
|
||||
std.log.debug("start - end: {d}..{d}", .{ s, e });
|
||||
std.log.debug("content: {s}", .{input[s..e]});
|
||||
break :value input[s..e];
|
||||
break :value input[s..node.token.end];
|
||||
}
|
||||
break :value "";
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user