Fixing established box.
This commit is contained in:
parent
5596bb2736
commit
c5dde5ffd0
|
|
@ -257,7 +257,8 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"direction": "horizontal",
|
"direction": "horizontal",
|
||||||
"width": 200
|
"width": 200,
|
||||||
|
"collapsed": true
|
||||||
},
|
},
|
||||||
"left-ribbon": {
|
"left-ribbon": {
|
||||||
"hiddenItems": {
|
"hiddenItems": {
|
||||||
|
|
@ -274,6 +275,7 @@
|
||||||
},
|
},
|
||||||
"active": "b8c0b940e83a0cce",
|
"active": "b8c0b940e83a0cce",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
|
"conf/sedSNuLNp",
|
||||||
"chapters/00_Introduction.md",
|
"chapters/00_Introduction.md",
|
||||||
"chapters/01_Getting_Started.md",
|
"chapters/01_Getting_Started.md",
|
||||||
"chapters/02_Features.md",
|
"chapters/02_Features.md",
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -19,6 +19,7 @@ For Debian / ZorinOS and likely Ubuntu based systems.
|
||||||
|
|
||||||
#### Code Editor
|
#### Code Editor
|
||||||
|
|
||||||
|
|
||||||
> [!established] Code Editor
|
> [!established] Code Editor
|
||||||
> [VSCodium](https://vscodium.com/) is recommend for privacy (telemetry/tracking) reasons
|
> [VSCodium](https://vscodium.com/) is recommend for privacy (telemetry/tracking) reasons
|
||||||
> - https://vscodium.com/
|
> - https://vscodium.com/
|
||||||
|
|
|
||||||
|
|
@ -10,21 +10,23 @@ local callout_env_map = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function BlockQuote(el)
|
function BlockQuote(el)
|
||||||
if #el.content > 0 and el.content[1].t == "Para" then
|
if #el.content > 0 and el.content[1].t == "Para" then
|
||||||
local firstPara = el.content[1]
|
local firstPara = el.content[1]
|
||||||
if #firstPara.content > 0 and firstPara.content[1].t == "Str" then
|
if #firstPara.content > 0 and firstPara.content[1].t == "Str" then
|
||||||
local firstWord = firstPara.content[1].text
|
local firstWord = firstPara.content[1].text
|
||||||
local calloutType = firstWord:match("^%[%!(%w+)%]$")
|
local calloutType = firstWord:match("^%[%!(%w+)%]$")
|
||||||
|
|
||||||
if calloutType and callout_env_map[calloutType] then
|
if calloutType and callout_env_map[calloutType] then
|
||||||
-- remove the [!type] marker
|
-- 1. Remove the [!type] marker
|
||||||
table.remove(firstPara.content, 1)
|
table.remove(firstPara.content, 1)
|
||||||
-- remove one following space if present
|
|
||||||
|
-- 2. Remove one following space if present
|
||||||
if #firstPara.content > 0 and firstPara.content[1].t == "Space" then
|
if #firstPara.content > 0 and firstPara.content[1].t == "Space" then
|
||||||
table.remove(firstPara.content, 1)
|
table.remove(firstPara.content, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- gather optional custom title (may contain spaces)
|
-- 3. Gather optional custom title
|
||||||
local titleInlines = {}
|
local titleInlines = {}
|
||||||
while #firstPara.content > 0 do
|
while #firstPara.content > 0 do
|
||||||
local t = firstPara.content[1].t
|
local t = firstPara.content[1].t
|
||||||
|
|
@ -37,14 +39,24 @@ function BlockQuote(el)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local customTitle = pandoc.utils.stringify(pandoc.Span(titleInlines))
|
local customTitle = pandoc.utils.stringify(pandoc.Span(titleInlines))
|
||||||
customTitle = customTitle:gsub("^%s+", ""):gsub("%s+$", "")
|
customTitle = customTitle:gsub("^%s+", ""):gsub("%s+$", "")
|
||||||
if customTitle == "" then customTitle = nil end
|
if customTitle == "" then customTitle = nil end
|
||||||
|
|
||||||
|
-- 4. Map to LaTeX environment
|
||||||
local env = callout_env_map[calloutType]
|
local env = callout_env_map[calloutType]
|
||||||
local titleOption = customTitle and ("[" .. customTitle .. "]") or "[]"
|
local titleOption = customTitle and ("[" .. customTitle .. "]") or "[]"
|
||||||
|
|
||||||
local latex = "\\begin{" .. env .. "}" .. titleOption .. "\n"
|
-- 5. Handle the Margin Issue
|
||||||
|
-- We add \par and \medskip specifically for 'established'
|
||||||
|
local prefix = ""
|
||||||
|
if calloutType == "established" then
|
||||||
|
prefix = "\\par\\medskip\\noindent\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 6. Construct the LaTeX block
|
||||||
|
local latex = prefix .. "\\begin{" .. env .. "}" .. titleOption .. "\n"
|
||||||
.. pandoc.write(pandoc.Pandoc(el.content), "latex")
|
.. pandoc.write(pandoc.Pandoc(el.content), "latex")
|
||||||
.. "\n\\end{" .. env .. "}"
|
.. "\n\\end{" .. env .. "}"
|
||||||
|
|
||||||
|
|
@ -52,4 +64,4 @@ function BlockQuote(el)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Loading…
Reference in New Issue