TLDR: This is a workaround to export pdf from Obsidian via typora using python script.
Requirement: You need to have python and Typora installed. And change two paths in the script as instructed.(I’m a python beginner, and I learnt regex few hours ago, so my code might be ugly…
)
import re
attachment_folder = r"D:\\Important\\Obsidian\\My notes\\_resources"
file_path = "C:\\Users\\Frank\\Desktop\\test.md"
'''
replace above two paths with yours.
Windows User:BACKSLASH NEEDS TO BE DOUBLED!!! No need to change code below.
Linux and MacOS user: use single slash '/' instead of double backslash '\\' in your two paths and change line 20's '\\' to '/'
'''
with open(file_path, 'r+', encoding='utf-8') as md:
orig_text = md.read()
text = re.sub("!\[\[((.*)\.\w+)]]", r"", orig_text)
with open(file_path, 'w+', encoding='utf-8') as md:
md.write(text)