Skip to content

Fix native escaped backtick rendering. #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
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: 1 addition & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ do_latex() {
--standalone
--highlight-style=${SYNTAX_HIGHLIGHT_STYLE}
--template=${TEMPLATE_PDF}
--lua-filter=render-helpers.lua
--lua-filter=fix-latex-backticks.lua
--lua-filter=convert-diagrams.lua
--lua-filter=convert-images.lua
--lua-filter=center-images.lua
Expand Down Expand Up @@ -882,7 +882,6 @@ do_docx() {
cmd=(pandoc
--embed-resources
--standalone
--lua-filter=render-helpers.lua
--lua-filter=convert-diagrams.lua
--lua-filter=convert-images.lua
--lua-filter=parse-html.lua
Expand Down Expand Up @@ -926,7 +925,6 @@ do_html() {
--standalone
--template=${TEMPLATE_HTML}
${HTML_STYLESHEET_ARGS}
--lua-filter=render-helpers.lua
--lua-filter=convert-diagrams.lua
--lua-filter=parse-html.lua
--lua-filter=apply-classes-to-tables.lua
Expand Down
30 changes: 30 additions & 0 deletions filter/fix-latex-backticks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- Correct backtick rendering in Latex. Without this, escaped backticks are displayed as curly open single quote marks.

function Str(el)
local new_inlines = {}
local current_text = ""

if FORMAT ~= "latex" or not el.text:match("`") then
return el
end

for i = 1, #el.text do
local char = el.text:sub(i, i)

if char == "`" then
if current_text ~= "" then
table.insert(new_inlines, pandoc.Str(current_text))
current_text = ""
end
table.insert(new_inlines, pandoc.RawInline('latex', '\\textasciigrave{}'))
else
current_text = current_text .. char
end
end

if current_text ~= "" then
table.insert(new_inlines, pandoc.Str(current_text))
end

return new_inlines
end
29 changes: 0 additions & 29 deletions filter/render-helpers.lua

This file was deleted.

10 changes: 0 additions & 10 deletions guide.tcg
Original file line number Diff line number Diff line change
Expand Up @@ -1460,16 +1460,6 @@ Carl->>Bob: Goodbye
Bob->>Alice: Goodbye
```

## Helper classes

To wrap a word in backticks that render as normal text, you can use the following syntax:

```md
[These words]{.btick} are in backticks.
```

[These words]{.btick} are in backticks.

## TCG Storage Workgroup Customizations

TCG Storage committee uses command `MethodsOrUID` to render Names of methods and UIDs in \MethodsOrUID{Courier New font}.
Expand Down
Loading