From 9feec47f7c5ee9dfff5f2919afefeeaad8c3332f Mon Sep 17 00:00:00 2001 From: YISH Date: Sat, 15 Oct 2022 11:24:01 +0800 Subject: [PATCH] :art: fix PDF: $$ symbols surrounding --- lua/pdf.lua | 12 ++++++++++++ manifest.json | 2 +- package.json | 2 +- src/export_command_templates.ts | 2 +- src/lua.ts | 2 ++ versions.json | 3 ++- 6 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 lua/pdf.lua diff --git a/lua/pdf.lua b/lua/pdf.lua new file mode 100644 index 0000000..05fc651 --- /dev/null +++ b/lua/pdf.lua @@ -0,0 +1,12 @@ + +return { + { + Math = function (elem) + if elem.text:find("^%s*\\begin{") ~= nil then + return pandoc.RawInline('tex', elem.text) + else + return elem + end + end, + } +} diff --git a/manifest.json b/manifest.json index 34334eb..eb0af13 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-enhancing-export", "name": "Obsidian Enhancing Export", - "version": "1.1.5", + "version": "1.1.6", "minAppVersion": "0.12.0", "description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", "author": "YISH", diff --git a/package.json b/package.json index bf046b6..77e5a55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-enhancing-export", - "version": "1.1.5", + "version": "1.1.6", "description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", "main": "dist/main.js", "scripts": { diff --git a/src/export_command_templates.ts b/src/export_command_templates.ts index 68bb091..ed5be4c 100644 --- a/src/export_command_templates.ts +++ b/src/export_command_templates.ts @@ -51,7 +51,7 @@ export default { name: 'PDF', type: 'pandoc', arguments: - '-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t pdf', + '-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t pdf', extension: '.pdf', }, 'Word (.docx)': { diff --git a/src/lua.ts b/src/lua.ts index 21c6e90..26f30fe 100644 --- a/src/lua.ts +++ b/src/lua.ts @@ -4,6 +4,7 @@ import polyfill from 'lua/polyfill.lua'; import math_block from 'lua/math_block.lua'; import markdown from 'lua/markdown.lua'; import markdown_hugo from 'lua/markdown+hugo.lua'; +import pdf from 'lua/pdf.lua'; const files = { 'utf8_filenames.lua': utf8_filenames, @@ -12,6 +13,7 @@ const files = { 'math_block.lua': math_block, 'markdown.lua': markdown, 'markdown+hugo.lua': markdown_hugo, + 'pdf': pdf }; export default files; diff --git a/versions.json b/versions.json index 9198cb8..89a97fb 100644 --- a/versions.json +++ b/versions.json @@ -12,5 +12,6 @@ "1.1.2": "0.12.0", "1.1.3": "0.12.0", "1.1.4": "0.12.0", - "1.1.5": "0.12.0" + "1.1.5": "0.12.0", + "1.1.6": "0.12.0" } \ No newline at end of file