Python script for converting obsidian md-file to html (recursively adds all link/images)

Overview

ObsidianToHtmlConverter

I made a small python script for converting obsidian md-file to static (local) html (recursively adds all link/images) I made this script for when I need to distribute something from my obsidian vault to someone that either have obsidian, or doesn't.

The script has 1 option:

  1. Export the choosen md-file to a new vault and bring all the images and linked md-files with it (recursively!)
    • Easily opened as a new vault in obsidian and everything just works!
  2. Exactly like nr 1 above, but also create html-files next to the md-files (with images and working links to other md.html-files in vault)
    • The script puts an index.html-file in the root of the exported vault that is a direct link to your exported file.md.html for easily access

Run this script from the root of obsidian vault

usage: python3 exportMdFileToHtml.py <filename.md> <[y/n](optional) y=default => html-export>

  • "<filename.md>" no filepath needed unless you have several files with same name

Only tesed on Linux!

  • script uses ~/export_<filename> as output-foldername, so maybe have to change for windows...
Comments
  • Alternative

    Alternative

    Hi klalle,

    Just to let you know I've made something similar: https://github.com/obsidian-html/obsidian-html

    Currently it seems that my version has a lot more features (that I personally require for converting my obsidian files to html), but I really like how simple your script is, and that it has no external dependencies.

    You can see all the features it implements to fully translate obsidian to markdown (and from there to html using python-markdown) here: https://obsidian-html.github.io/. Maybe it can be inspiration showing you what you're still missing in your script.

    I know this is a shameful plug, and I by no means mean to one-up you. (Writing a solution to a problem yourself is the best thing about programming after all). I thought it might be useful for you and the users of your script, if they need a more powerful option (with unavoidable extra setup complexity ;) )

    You can remove this if this kind of posting is not okay.

    opened by dwrolvink 2
  • I'm having trouble understanding and invoking the script

    I'm having trouble understanding and invoking the script

    I'm anxious to try out this script, but I haven't had any luck actually making it run.

    I don't code or live on the command line so I'm having trouble interpreting how to specify the answers to the two required questions. Anything I've tried so far hasn't worked.

    1. The first parameter "Exports the choosen md-file to a new vault". Where is this "new vault"? Can I specify what directory / folder to export to?

    2. How I specify the switches isn't clear to me. Would you please provide an example of how to invoke the script with a filename and the two optional parameters chosen? That would make things much clearer I think.

    Thanks for your work and thank for any help you can offer!

    opened by GrantsTracks2121 1
  • Images are not sized correctly.  Pull request available

    Images are not sized correctly. Pull request available

    I found that the tool is not sizing images properly.
    I found and fixed the issue in the code and have a pull request for you. Should I issue you the pull request?

    opened by wealthychef1 0
  • Embedded markdown pages are not copied recursively

    Embedded markdown pages are not copied recursively

    Hi, Great work Pulling off this script!! I really Appreciate it. Everything is working as expected, Except the markdown pages embedded are not getting copied to the target folder. image

    opened by nikhildr22 0
  • Allow to specify exporting only files containing certain frontmatter, or exclude

    Allow to specify exporting only files containing certain frontmatter, or exclude

    For example, if frontmatter contains "publish: yes" then include the file. If it contains "publish: no" or "status: draft" etc., then don't export.

    In effect, whitelist as well as blacklist for exporting.

    opened by benbohmer 0
Owner
null
JD-backup is an advanced Python script, that will extract all links from a jDownloader 2 file list and export them to a text file.

JD-backup is an advanced Python script, that will extract all links from a jDownloader 2 file list and export them to a text file.

Kraken.snv 3 Jun 7, 2022
Ahmed Hossam 12 Oct 17, 2022
Donatus Prince 6 Feb 25, 2022
Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Travis Gruber 2 Dec 24, 2021
Islam - This is a simple python script.In this script I have written all the suras of Al Quran. As a result, by using this script, you can know the number of any sura at the moment.

Introduction: If you want to know sura number of al quran by just typing the name of sura than you can use this script. Usage in termux: $ pkg install

Fazle Rabbi 1 Jan 2, 2022
Get a link to the web version of a git-tracked file or directory

githyperlink Get a link to the web version of a git-tracked file or directory. Applies to GitHub and GitLab remotes (and maybe others but those are no

Tomas Fiers 2 Nov 8, 2022
apysc is the Python frontend library to create html and js file, that has ActionScript 3 (as3)-like interface.

apysc apysc is the Python frontend library to create HTML and js files, that has ActionScript 3 (as3)-like interface. Notes: Currently developing and

simonritchie 17 Dec 14, 2022
Bootstraparse is a personal project started with a specific goal in mind: creating static html pages for direct display from a markdown-like file

Bootstraparse is a personal project started with a specific goal in mind: creating static html pages for direct display from a markdown-like file

null 1 Jun 15, 2022
Python script to preprocess images of all Pokémon to finetune ruDALL-E

ai-generated-pokemon-rudalle Python script to preprocess images of all Pokémon (the "official artwork" of each Pokémon via PokéAPI) into a format such

Max Woolf 132 Dec 11, 2022
A Python3 script to decode an encoded VBScript file, often seen with a .vbe file extension

vbe-decoder.py Decode one or multiple encoded VBScript files, often seen with a .vbe file extension. Usage usage: vbe-decoder.py [-h] [-o output] file

John Hammond 147 Nov 15, 2022
A GUI love Calculator which saves all the User Data in text file(sql based script will be uploaded soon). Interative GUI. Even For Admin Panel

Love-Calculator A GUI love Calculator which saves all the User Data in text file(sql based script will be uploaded soon). Interative GUI, even For Adm

Adithya Krishnan 1 Mar 22, 2022
A small script I made that takes any standard Decklist of magic the gathering cards and pulls all card images from scryfall at once!

A small script I made that takes any standard Decklist of magic the gathering cards and pulls all card images from scryfall at once!

null 15 Aug 26, 2022
Tool that adds githuh profile views to ur acc

Tool that adds githuh profile views to ur acc

Lamp 2 Nov 28, 2021
A Bot that adds YouTube views to your video of choice

YoutubeViews Free Youtube viewer bot A Bot that adds YouTube views to your video of choice Installation git clone https://github.com/davdtheemonk/Yout

ProbablyX 5 Dec 6, 2022
nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

null 150 Jan 7, 2023
Blender addon that simplifies access to useful operators and adds missing functionality

Quick Menu is a Blender addon that simplifies common tasks Compatible with Blender 3.x.x Install through Edit -> Preferences -> Addons -> Install... -

passivestar 94 Dec 27, 2022
Adds a Bake node to Blender's shader node system

Bake to Target This Blender Addon adds a new shader node type capable of reducing the texture-bake step to a single button press. Please note that thi

Thomas 8 Oct 4, 2022
A tool converting rpk (记乎) to apkg (Anki Package)

RpkConverter This tool is used to convert rpk file to Anki apkg. 如果遇到任何问题,请发起issue,并描述情况。如果转换rpk出现问题,请将文件发到邮箱 ssqyang [AT] outlook.com,我会debug并修复问题。 下

null 9 Nov 1, 2021
Buildium-to-stessa - Automation to assist in converting Buildium transactions into Stessa format

Buildium Transactions -> Stessa Transactions There is currently no third-party i

Austin Comstock 4 Apr 17, 2022