Giter Club home page Giter Club logo

mokeyish / obsidian-enhancing-export Goto Github PK

View Code? Open in Web Editor NEW
300.0 6.0 17.0 785 KB

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/ ). It's allow you to export to formats like Markdown、Markdown (Hugo https://gohugo.io/ )、Html、docx、Latex etc.

License: MIT License

JavaScript 0.70% Lua 5.83% TypeScript 64.65% CSS 0.06% TeX 28.75%
pandoc export export-to-html obsidian export-to-docx export-to-latex obsidian-plugin export-to-hugo

obsidian-enhancing-export's Introduction

Obsidian Enhancing Export Plugin

GitHub release (latest by date including pre-releases) Obsidian Downloads

English | 中文

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/). It's allow you to export to formats like Markdown,Markdown (Hugo),HTML,docx,Latex etc.

Where Markdown,Markdown (Hugo),HTML will export and its media resource together.

Note: Markdown,Markdown (Hugo),HTML are tested in Mac OS, Windows, and Linux as I used it for myself, others are not tested well.

Ads: You might like my other plugins 🤪

Screen shot

  • Export view,click on Export to... on file menu.

  • Setting view

Installation

  1. First install the latest pandoc (3.1.9+), and then add pandoc path to environment variable PATH or set absolute path of pandoc in the plugin setting view.

    See more details in https://pandoc.org/installing.html

  2. Search obsidian-enhancing-export in the community plugins of obsidian, and install it.

Customize export commands

You can customize your export command by yourself, click add in the plugin setting view and then choose template custom to add new custom configuration.

Variables

You can use ${variables} in custom export command, their values are:

Key Value
${outputPath} Output file path after export. For example, if your export to location /User/aaa/Documents/test.pdf, then ${outputDir} will be replace that path.
${outputDir} Output directory of saved exported file,It will be /User/aaa/Documents in above case.
${outputFileName} File name (without extension) of the saved exported file. It will be test in above case.
${outputFileFullName} File name (with extension) of the saved exported file. It will be test.pdf in above case.
${currentPath} Path of currently edited file. For example, if your are editing /User/aaa/Documents/readme.md, the the value will be /User/aaa/Documents/readme.md.
${currentDir} Current directory of currently edited file, It will be/User/aaa/Documents in above case.
${currentFileName} Filename without extension of currently edited file, It will be readme in above case.
${currentFileFullName} Filename with extension of currently edited file. It will be readme.md in above case.
${vaultDir} The obsidian current vaultDir.
${attachmentFolderPath} The attachmentFolderPath of Obsidian.
Others variables You can use keyword: value in YAML Front Matter, then use ${metadata.keyword}

Related resources

Finally

  • Welcome to provide more command templates to here.
  • Feel free to file an issue for any questions.

obsidian-enhancing-export's People

Contributors

banus avatar feralflora avatar github-actions[bot] avatar jgenc avatar luckman212 avatar mokeyish avatar pxammaxp avatar skrobul avatar thefermi0n avatar universvm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

obsidian-enhancing-export's Issues

Word export fails

See error message below.
Works for other plain files, I removed the embedded PDF - thought that was the problem, but still the same message

Images in that file are stored at Imgur... that should not be a problem or?

Any idea?

image

更新之后整个obsidian卡死

因卡死时无法打开 devtools ,看不到 console 输出,逐个排查之后发现是更新 enhancing export 导致的,在 .obsidian/community-plugins.json 里手动删除行 "obsidian-enhancing-export" 来关闭本插件后得以继续运行obsidian。

系统版本:macOS Ventura 13.2.1 (apple silicon)
obsidian版本:v1.1.16

[Solution] Method to fix when pandoc.path is nil

I think it is related to this issue
I was using pandoc of anaconda, which is v2.12, and on this version pandoc.path was nil and error occured when I execute export.
(Since I had installed v2.18 pandoc by chocolatey, I confused that I was using latest pandoc. But since anaconda's pandoc(v2.12) was executing with higher priority, error occured.)

After I removed pandoc of conda and installed v2.18(latest) pandoc again, pandoc.path properly set and export worked.
I submit this issue to help someone who will experience same error.

conda uninstall pandoc
choco install pandoc

Should this work?

I am receiving the error "You caught an error! etc. " When I insert a new quote block, the authors don't show up. I have cleared metdata cache and re-scanned.

I have the following in one file:

:::One Person:::

> Quote A is a very very short quote.

> Quote B is another quote, not too long, not too short...but something in between.

:::Another Person:::

> Quote C is longer. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui official

#quote

and in another, this:

```localquote
id V6h57
author One Person
refresh 1s

Pandoc command not found

I get the error that the pandoc command is not found even though I set /opt/homebrew/bin/pandoc as the path in the settings.

Export to Hugo Markdown is not exporting images, errors with html export.

macOS 13.2.1 (22D68)
Version 1.1.8 (just upgraded)

I have tested and I can run pandoc commands on the Google Drive local filesystem (referenced in the errors), so it isn't a permissions or privacy problem. I also copied the vault to the local filesystem and tested again, I got the same results, so it isn't an issue with the Google Drive file system. I also upgraded pandoc.

  • When exporting to Markdown (Hugo), a folder is created for the images named <original-document-name> but no images are exported.

  • When exporting to Markdown, a folder is created for the images, named <original-document-name>-images but no images are exported.

  • When exporting to HTML, an bunch of warnings that the images could not be fetched appears.
    image

Current settings:
image

Use of deprecated pandoc flag in PDF export template

Trying to export to PDF using pandoc 2.19.2, I get an error saying Deprecated: --self-contained. use --embed-resources --standalone.

Looking at the export command templates, it looks like the PDF template is the only one still using --self-contained:

'PDF': {
name: 'PDF',
type: 'pandoc',
arguments:
'-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --self-contained --metadata title="${currentFileName}" -s -o "${outputPath}" -t pdf',
extension: '.pdf',
},

Creating a new export setting copied from the default PDF one, and replacing --self-contained with --embed-resources --standalone got rid of the error, and successfully exported a PDF for me.

Win 11 - export is not generated

I finally managed to install pandoc on my win 11 machine:
pandoc 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
User data directory: C:\Users\ih8snow\AppData\Roaming\pandoc
Copyright (C) 2006-2022 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

path is set in the environment variable and test did work

Now, it's not working with the plugin.
For example I start an export to .md (or any other type) and the export starts with the "generating ..." window, but except the moving animation, nothing happens.
This happens with all export file types.
image

Any idea where the error is placed (maybe between my ears??)

Export not working on Mac

Hi,
I followed all instrurctions and export works with the "pandoc plugin".
Using your plugin I get error messages for all formats like the one below.
Any help?
Running latest Mac OS and current Obsidian version

Command: /usr/local/bin/pandoc -f markdown --resource- x
path="/Users/4me/Documents/Second Brain/001-Projects/700-02 PV-
Anlage" --resource-path="/Users/4me/Documents/Second Brain/001-
Projects/700-02 PV-Anlage/attachments" --lua-
filter="/Users/4me/Documents/Second Brain/.obsidian/plugins/obsidian-
enhancing-export/lua/pdf.lua" --embed-resources --standalone --metadata
title="Sonnen Solar Anlage" -s -o "/Users/4me/Documents/Dokumente -
MacBook Air von Jérn/Sonnen Solar Anlage.pdf" -t pdf
"/Users/4me/Documents/Second Brain/001-Projects/700-02 PV-
Anlage/Sonnen Solar Anlage.md", Error: Command failed:
/usr/local/bin/pandoc -f markdown --resource-
path="/Users/4me/Documents/Second Brain/001-Projects/700-02 PV-
Anlage" --resource-path="/Users/4me/Documents/Second Brain/001-
Projects/700-02 PV-Anlage/attachments" --lua-
filter="/Users/4me/Documents/Second Brain/.obsidian/plugins/obsidian-
enhancing-export/lua/pdf.lua" --embed-resources --standalone --metadata
title="Sonnen Solar Anlage" -s -o "/Users/4me/Documents/Dokumente -
MacBook Air von Jérn/Sonnen Solar Anlage.pdf" -t pdf
"/Users/4me/Documents/Second Brain/001-Projects/700-02 PV-
Anlage/Sonnen Solar Anlage.md" Error running filter
/Users/4me/Documents/Second Brain/.obsidian/plugins/obsidian-enhancing-
export/lua/pdf.lua: cannot open /Users/4me/Documents/Second
Brain/.obsidian/plugins/obsidian-enhancing-export/lua/pdf.lua: No such file
or directory

Word export fails to honor MD headings

When I export an Obsidian doc to word, the '#' headings are just tagged on to the end of the preceding line instead of becoming headers of some kind.

Sample input doc:
CleanShot 2023-01-02 at 07 25 46@2x

Sample output doc:
CleanShot 2023-01-02 at 07 26 19@2x

Embedded notes are not exported

When exporting a note, which contains embedded another note, the embedded note is not rendered.
Instead, only the link is shown:
![[another note]]

[BUG] Custom command : Undefined extension in output

My command line :

pandoc -f markdown+lists_without_preceding_blankline+spaced_reference_links+hard_line_breaks+yaml_metadata_block+implicit_figures --resource-path="G:/Mon Drive/Seed/_assets/attachments/" --citeproc -L "..\pagebreak.lua" --reference-doc="..\custom-reference.docx" -s -o "${outputPath}" -t docx

At the moment I choose to export, Obsidian seems to crash (infinite loading without error).

Also, I notice :

  • I need to add pandoc before -f because it doesn't be recognized :
'-f' n'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
  • Custom doesn't append .docx (I have undefined)
  • Editing docx export give me error because of filter lua path (..\) :
error: Command failed: pandoc -f markdown --resource-path="G:\Mon Drive\Seed\10. Master\Stage\mémoire\Introduction" -s -o "C:\Users\Lili\Downloads/Introduction.docx" -t docx -f markdown+lists_without_preceding_blankline+spaced_reference_links+hard_line_breaks+yaml_metadata_block+implicit_figures --resource-path="G:/Mon Drive/Seed/_assets/attachments/" --citeproc -L "..\pagebreak.lua" --reference-doc="..\custom-reference.docx" "G:\Mon Drive\Seed\10. Master\Stage\mémoire\Introduction\Introduction.md"
Error running filter ..\pagebreak.lua:
cannot open ..\pagebreak.lua: No such file or directory

Cannot export to PDF: $$ symbols surrounding align environment fails the process

This is similar to #8 , but with a different behavior: the exporting process just fails.

Test document:

$$
\begin{align*}
a&=b\\
&=c
\end{align*}
$$

Result:

Screenshot_20221011_182838

My fixes:

add a lua filter:

return {
    {
        Math = function (elem)
            if elem.text:find("^%s*\\begin{") ~= nil then
                return pandoc.RawInline('tex', elem.text)
            else
                return elem
            end
        end,
    }
}

FR:是否可以增加用命令面板导出的功能

很高兴发现这个插件,谢谢作者!

  1. 我发现只能通过点击导出为来导出,是否可以考虑增加命令指令进行导出
  2. 覆盖提醒的能否保留之前的选择状态,而不是要重复的点击

Error exporting to PDF

To get past other errors, I've added --pdf-engine-xelatex to my custom command, and now I can get this to work from the command line:
pandoc Untitled\ 1.md -f markdown --standalone --lua-filter="/home/akn/Obsidian/.obsidian/plugins/obsidian-enhancing-export/lua/pdf.lua" --embed-resources --pdf-engine=xelatex -s -o test1.pdf

This is my custom command:
-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" --embed-resources --standalone --metadata title="${currentFileName}" --pdf-engine=xelatex -s -o "${outputPath}" -t pdf

The error message that pops up in Obsidian is simply:
/bin/sh/sh: 0: Illegal option -

I can export using the built-in commands for most of the others: epub, rtf, mediawiki, latex, docx, odt, html

Any ideas?

[feature request] implement ${vaultDir} variable

Hey thanks you for this awesome plugin!

I finally found a way to remove wikilinks form markdown export pandoc-wikilinks-filter, but the problem is that my vault has various levels subfolders, while the filter is installed in the vault root.
So setting the filter path relative to the current file is not possible and setting an absolute path makes the vault less portable.
Having a ${vaultDir} (or ${vaultRoot}) variable would make specifying filters an bibliography files across platforms much easier.
What do you think?

Kind regards
fruchtblase

Settings not stored

After making changes to the plugin settings, like switching off "Open exported file", and restarting, the setting is turned back on. Also experienced that custom arguments have been reset upon relaunch.

导出为word,不再段落间的换行符没有了

一个非常棒的插件,感谢作者!
但转换为word时还有点小问题,

  1. 导出为word时,如果obsidian md文件中有2个换行符,则导出到docx中能够实现换行(md中的2个换行符变为了一个回车)。
  2. 如果obsidian段落间只有1个换行符,则不能够换行,原换行符在docx中被替换为了一个小圆点。
    希望作者能够修正,谢谢!

Generating does not lead to output file

Hi,

I'm trying the plugin. It used to work until this morning when I updated and tried to export literally any file.

It just keeps saying "generating" on any file.

Can you replicate this?

yaml parse error

when exporting md file to html i get this error
i will provide

  • exception
  • md file

NOTE: if i export to html on a simpler .md file this problem does not appear. the content of my file are cause this error.

exception

Command: pandoc -f markdown --resource-path="C:\Users\space-sattilite\OneDrive\Desktop\Marbella" --resource-path="C:\Users\space-sattilite\OneDrive\Desktop\Marbella" --lua-filter="C:\Users\space-sattilite\OneDrive\Desktop\Marbella/.obsidian/plugins/obsidian-enhancing-export/lua/math_block.lua" --self-contained --metadata title="JS_objects" -s -o "C:\Users\space-sattilite\Downloads/JS_objects.html" -t html --mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js" "C:\Users\space-sattilite\OneDrive\Desktop\Marbella\JS_objects.md",Error:Command failed: pandoc -f markdown --resource-path="C:\Users\space-sattilite\OneDrive\Desktop\Marbella" --resource-path="C:\Users\space-sattilite\OneDrive\Desktop\Marbella" --lua-filter="C:\Users\space-sattilite\OneDrive\Desktop\Marbella/.obsidian/plugins/obsidian-enhancing-export/lua/math_block.lua" --self-contained --metadata title="JS_objects" -s -o "C:\Users\space-sattilite\Downloads/JS_objects.html" -t html --mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js" "C:\Users\space-sattilite\OneDrive\Desktop\Marbella\JS_objects.md"
YAML parse exception at line 2, column 97:
mapping values are not allowed in this context

md file

md file download link (valid for 30 days): https://easyupload.io/spwjpi

[Bug]: Redundant $$ symbols in some kind of formulas in .html

How to reproduce?

  1. Create new note.
  2. Paste this code
Test bug:

$$
\begin{align*}
	\begin{rcases}
        \lambda_{1}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\
        \lambda_{2}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\
	\end{rcases} & \Rightarrow \text{stable knot} \\
	
	\begin{rcases}
        \lambda_{1}(a_{11}^{*}, \ldots, a_{22}^{*}) > 0 \\
        \lambda_{2}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\
	\end{rcases} & \Rightarrow \text{saddle}
\end{align*}
$$
  1. Export to html.

Expected output:
image

Actual output:
image

can't export attachments when export WORD

The word file can be exported normally, but the image attachments in the md file cannot be exported to the generated word file correctly.
Whether this is related to my attachment folder settings and inline types in OB


能够正常的导出word文件,但md文件中的图片附件却没能正确的导出到生成的word文档中。
这是否与我在ob中的附件文件夹设置及内联类型有关


image

导出PDF失败

同一个文件,导出docx是没有问题的,PDF报错。
image

Html Pandoc extra arguments not saving

I have a stylesheet that I was to pass to pandoc with -c stylesheet.css and it works when I put that in "extra arguments". But the next time I open Obsidian, it resets the "extra arguments" field, and it doesn't render with the stylesheet.

不能正常导出图片

导出前的代码是这样的:

![[assets/test.png]]

导出HTML之后并不是图片,而是这样的文本:

[[assets/test.png]]

Cannot find the export button

On Mac, I have installed the plugin and enable it:
image

And installed pandoc:
image

But cannot find the new export button in the file menu:
iShot_2022-10-18_12 12 28

[Feature Request]

Any way to include the textbundle export format in this Obsidian plugin?

PDF export error

Got the following when exporting a small file with one picture.
image
I do have pandoc 2.19.2 installed and in the path.
Obsidian says it's installed and I see no errors there
Any suggestions for what I'm doing wrong?

windows端导出报错1

手动指定安装目录如下:
C:\Program Files\Pandoc\pandoc.exe
我尝试手动指定或是自动检查路径,都会报错,报错如下图
image

HTML images have the src and " stripped off

First of all, AWESOME addon, great work!

In my testing I found that images are broken if they are already HTML.

For example, this in my obsidian markdown file:

<img align="right" alt="This is boring" width="150" src="https://c.tenor.com/KmPFMGQ07-4AAAAd/hffgf.gif/">

becomes this in both the hugo and regular markdown conversions:

<img align="right" alt="This is boring" width="150" https://c.tenor.com/KmPFMGQ07-4AAAAd/hffgf.gif/>

Any suggestions?

macOS 导出 PDF、Textbundle等不成功

经测试,在macOS中除导出 Markdown 、Markdown(Hugo)、Html、Word(docx) 成功外,导出 PDF、Textbundle等不成功,
导出 PDF和Textbundle是很常用的功能,请完善,谢谢!

导出word文档时,内嵌图片显示链接而非图片

类似下面的内嵌图片,在obsidian编辑器中可以正常预览图片,而使用本插件导出word文档时,内嵌图片显示链接而非图片。

![[Pasted image 20230109205956.png]]

麻烦看看是否可以修复,谢谢

Links left broken

Hi. MD-links to "filename.pdf" or "filename.png" are converted to href = "filename.pdf.html" og "filename.png.html" (class="internal link"). Correcting them manually solves the error. A bug, or my settings gone wrong? Regards.

导出的结果只是源代码

1.用dataview插件生成的表格用OB导出的PDF也都是渲染之后的结果,
2.在没有严格换行的情况下导出的word文件都没断行
3.在插件市还找不到该插件,只能手动安装

Obsidian app is unresponsive after 1.1.10 update

After updating to 1.1.10 version my obsidian app is unresponsive, the UI is complitely frozen and task manager shows 23% load
image
I unblocked myself by removing the plugin from community-plugins.json. Let me know if you need other info for debugging. Currently I'm on win 10 pro 22H2, i5 core 10th gen, 16 ram.

Using external .yml file for front-matter

I have a Latex template set up that I use when exporting to PDF. This template takes in some YAML front-matter which affects the output of the file (it's based on the Eisvogel template found here https://github.com/Wandmalfarbe/pandoc-latex-template).

I'm trying to set up a workflow where my export reads YAML front-matter from a separate file. This will allow me to have global style settings which are read and used each time I export.

I'm able to do from the terminal like this:

pandoc .pandoc-config.yml document.md --template report -s -o document.pdf

Where .pandoc-config.yml is a file in the same directory and which contains the frontmatter:

CleanShot 2023-01-23 at 14 15 33@2x

I've added the .pandoc-config.yml argument under the "Extra arguments" field of my Export Setting, then tried placing this file in the same vault directory as the .MD files in Obsidian. I've also tried adding it to the resources folder, but not success yet. Each time I receive this export error:

pandoc: .pandoc-config.yml: openBinaryFile: does not exist (No such file or directory)

Where is the right place to put the external YAML file? Is this approach even possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.