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
4 changes: 2 additions & 2 deletions Development/talagan_ReaImGui Markdown.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
--[[
@description ReaImGui Markdown : A Markdown rendering library for ReaImGui
@version 0.1.10
@version 0.1.11
@author Ben 'Talagan' Babut
@license MIT
@donation https://www.paypal.com/donate/?business=3YEZMY9D6U8NC&no_recurring=1&currency_code=EUR
@links
Forum Thread https://forum.cockos.com/showthread.php?t=301055
@changelog
- [Optimization] Reduce split function cost (thanks @Arkadata!)
- [Bug Fix] Correcting offsets for inline elements, could lead to UTF-8 corruption on checkbox click
@metapackage
@provides
[nomain] talagan_ReaImGui Markdown/reaimgui_markdown/**/*.lua
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ local function parse_inline(text, base_offset)
if k <= len then
local url = text:sub(j + 2, k - 1)
table.insert(nodes, new_node("Link", nil,
parse_inline(link_text, base_offset + i),
parse_inline(link_text, base_offset + i - 1),
{
url = url,
source_offset = { start = base_offset + i, end_pos = base_offset + k }
Expand All @@ -326,7 +326,7 @@ local function parse_inline(text, base_offset)
i = j + 1
end
else
buffer = buffer .. text:sub(i, j)
buffer = buffer .. text:sub(i, j)
buffer_start = base_offset + i
i = j + 1
end
Expand Down Expand Up @@ -354,7 +354,7 @@ local function parse_inline(text, base_offset)
local color, clean_content = extract_color(content)
-- Create Bold containing Italic
table.insert(nodes, new_node("Bold", nil, {
new_node("Italic", nil, parse_inline(clean_content, base_offset + i + 3), {
new_node("Italic", nil, parse_inline(clean_content, base_offset + i + 3 - 1), {
color = color,
})
}, {
Expand Down Expand Up @@ -398,7 +398,7 @@ local function parse_inline(text, base_offset)

local color, clean_content = extract_color(content)
table.insert(nodes, new_node("Bold", nil,
parse_inline(clean_content, base_offset + i + 2),
parse_inline(clean_content, base_offset + i + 2 - 1),
{
color = color,
source_offset = { start = base_offset + i, end_pos = base_offset + j + 1 }
Expand Down Expand Up @@ -434,7 +434,7 @@ local function parse_inline(text, base_offset)
if text:sub(j, j) == marker and not is_escaped(text, j) then
local color, clean_content = extract_color(content)
table.insert(nodes, new_node("Italic", nil,
parse_inline(clean_content, base_offset + i + 1),
parse_inline(clean_content, base_offset + i + 1 - 1),
{
color = color,
source_offset = { start = base_offset + i, end_pos = base_offset + j }
Expand Down Expand Up @@ -467,7 +467,7 @@ local function parse_inline(text, base_offset)
if text:sub(j, j) == "$" and not is_escaped(text, j) then
local color, clean_content = extract_color(content)
table.insert(nodes, new_node("Span", nil,
parse_inline(clean_content, base_offset + i + 1),
parse_inline(clean_content, base_offset + i + 1 - 1),
{
color = color,
source_offset = { start = base_offset + i, end_pos = base_offset + j }
Expand Down