Skip to content

Commit

Permalink
refactor: Avoid wrapping maths in a SIL construct
Browse files Browse the repository at this point in the history
It was adding an additional parsing step for no good reason, and we
can achieve the same thing with a direct AST construct.
  • Loading branch information
Omikhleia authored and Didier Willis committed Aug 11, 2023
1 parent 90e2cda commit db66785
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/markdown/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,11 @@ Please consider using a resilient-compatible class!]])

self:registerCommand("markdown:internal:math", function (options, content)
local mode = options.mode or "text"
-- NOTE: Not sure why the following doesn't work!!!!
-- SILE.call("math", {}, content)
SILE.processString("\\math[mode="..mode.."]{"..SU.contentToString(content).."}", "sil")
-- NOTE: The following doesn't work: SILE.call("math", {}, content)
-- Let's go for a lower-level AST construct instead.
SILE.process({
utils.createCommand("math", { mode = mode }, SU.contentToString(content))
})
end)

self:registerCommand("markdown:internal:nbsp", function (options, _)
Expand Down

0 comments on commit db66785

Please sign in to comment.