Mkdocs obsidian publish - Publish your obsidian vault through a python script

Overview

Mkdocs Obsidian

Mkdocs Obsidian is an association between a python script and a Material mkdocs template to get a personal wiki site based on your Obsidian Vault.

Mkdocs Obsidian Template

Owlly Seed (My Blog ; In French)

Screenshot

image_1 ![image_2(screenshot/image_2.png) image_3 image_4

Pre-requiries

You can install all package with pip install -r requirements.txt

Get started

First, copy the template in GitHub. To make it your, you need to change, in mkdocs.yml

  • site_name,
  • site_description
  • site_url
  • The logo and favicons
  • If you want, the palette, use color scheme from material and edit scheme and accent.

The material's theme includes a lot of parameters and personalization, so don't forget to check to make the site yours! Also, there is a hundred of plug-ins (“extension”) for mkdocs so don't hesitate to give an eye! You will find a lot here.

To try your site without online, use mkdocs serve. You can publish your website using Github Page using the gh-page branch. This branch is pulled by the .workflow file, so don't worry about it.

Now you have two choices : move the file you want in docs (and the subfolder you want) or you can use Mkdocs_Obsidian.

Obsidian compatibility

So, with the configuration I have done, the mkdocs support :

I didn't found a way to embed file with wiki links for the moment. Because of the strange behavior of roam links, these embedded file will be rendered as image. The script will care of this bug.

Mkdocs Obsidian

Utilities and interest

A vast party of the script is taken from my previous project, YAFPA

The script will care about some things you can forget :

  • Moving your image in assets ;
  • Change the admonition from the plugin to material admonition (mainly for codeblocks)
  • Remove Obsidian comment (%% text %%)
  • Create a folder structure based on the category key. Without it, the note will be created in docs/notes.

If you use the --meta option, it will also add, in the original file a link to the blog.

⚠️ If the script crash for any reason at the moment where the script updates the frontmatter, you can lose some file.

Metacopy

Using metacopy you can quickly copy a link to a shared page, without using this option (so, yes, the script does not edit your source file !). To create a link, you need to configure :

  1. category in key
  2. Add your set_url in base link
  3. Add category in key link

Also, you can remove the metacopy from your file menu using a key, so you can active metacopy only for share: true. Metacopy support also the paginations.index.

The final configuration of metacopy for mkdocs_obsidian will be :

So, in the end, a menu will appear on file with share: true and a category configured. This menu is on the left click and the file-menu. You can quickly copy a link from there, like a google or notion sharing link !

Here is a demo : click to get a video !

Usage

usage: obs2mk [-h] [--git] [--meta] [--keep] [--config] [--force | --filepath FILEPATH]

Create file in docs and relative folder, move image in assets, convert admonition code_blocks, add links and push.

optional arguments:
  -h, --help            show this help message and exit
  --git, --g, --G       No commit and no push to git
  --meta, --m, --M      Update the frontmatter
  --keep, --k, --K      Keep deleted file from vault and removed shared file
  --config, --c, --C    Edit the config file
  --force, --d, --D     Force conversion - only work if path not specified
  --filepath FILEPATH, --f FILEPATH
                        Filepath of the file you want to convert

At the first start of the script, it will ask you :

  • The absolute path of your vault and blog in your PC.
  • The key you want to use to share the file (default : share). This file will be in your site_package folder.

You can reconfigure the option with obs2mk --config.

By default, the script will remove all file that doesn't exist in the vault, and file where you remove the share (share: false, or removed the key). You can keep all these file with --k.

Share one file

To share only one file : obs2mk --f FILEPATH. It will :

  • Update the state status in original file (share: true)
  • Re-write the file if exist or create it in the folder you put in category This option will pull the file, regardless of what is the share state.

Share “all” files

You can share multiple documents using the share: true key, in frontmatter. The script will scan your entire vault and automatically convert the file with this key. There is two options :

  • By default, the script will compare with the older version and write only if changement are detected.
  • Using --force will force the re-writing.

Customization

There are some files to customize the script :

  • You can create custom admonition with material docs and adding the name in custom_admonition.yml.
  • You can completely exclude some folder of your vault with exclude_folder.yml. You can exclude specific path as folder1/subfolderA etc.
  • Using the \docs\assets\css\custom_attributes.css you can create specific aspect for your tags, and it also adds compatibility with CM6 Attribute and Contextual Typography.

Limitation

  • Nested admonition doesn't work for the moment. I don't use it a lot, but if you want, you could improve the script or create a mkdocs plugin to care of that.
  • The script will not delete the file and folder if you change the category key. Beware of this.
  • Share “all” can be long on big vault.
  • File with same name can have some problem while scanning because I don't keep your folder structure. Please, beware of this! Don't forget, you can use title if you want a specific name (and this name already exist).
  • Bloc citation doesn't work, the script will care of that.
  • Embed file (citation and # too) doesn't work, the script will also care about it !

Support

The script can work on any platform that support python. The script doesn't use Cpython, so don't worry about it for IOS.

IOS

Using :

First, in a-shell, run pickFolder and choose the folder of your vault, and rerun pickFolder to choose the folder where are the blog data (you need to clone with Working Copy) After, do showmarks and copy the two path in any note app. Check if the path is not broken because of the paste! You can also do :

cd 
showmarks > bookmark
vim bookmark

Here is a blank sheet to help you if you want to manually write / edit it :

vault=
blog_path=
blog=
share=

With :

  • vault: Vault Absolute Path
  • blog_path : Blog repository absolute path
  • blog : Blog link (same as site_url from mkdocs.yml)
  • share : your wanted share key ; by default : share

Before running the shortcuts, you need to install all requirements, aka :

pip install obs2mk
obs2mk --config

After, in a-shell, you can use the same option as on a PC.

Obsidian

→ Please use Wikilinks with “short links” (I BEG YOU) You can integrate the script within obsidian using the nice plugin Obsidian ShellCommands.

You could create two commands :

  1. share all : obs2mk
  2. share one : obs2mk --f {{file_path:absolute}}

You can use :

Frontmatter and option

Script

The script need one key, to share the file. You can configure the key in the configuration of the script.

If you want a folder structure in docs, you need to use the category keys, with the form of path/path. You can also block a file to update with update: false.

Note : With awesome-pages you can hide folder from navigation. To hide a file, just use hidden in category (as category: hidden). Links, image will work without problem.

Mkdocs

Material give you the possibility to add SEO tags with :

  • description
  • title (will change too the title in the navigation)
  • image: Add an image (don't forget the format) / Need to be a relative link.

Template

So, the final frontmatter template is :

---
title:
share:
description:
category:
---
You might also like...
Plugins for MkDocs.
Plugins for MkDocs.

Plugins for MkDocs and Python Markdown pip install neoteroi-mkdocs This package includes the following plugins and extensions: Name Description Type m

Resource hub for Obsidian resources.

Obsidian Community Vault Welcome! This is an experimental vault that is maintained by the Obsidian community. For best results we recommend downloadin

This tutorial will guide you through the process of self-hosting Polygon

Hosting guide This tutorial will guide you through the process of self-hosting Polygon Before starting Make sure you have the following tools installe

Python script to generate Vale linting rules from word usage guidance in the Red Hat Supplementary Style Guide

ssg-vale-rules-gen Python script to generate Vale linting rules from word usage guidance in the Red Hat Supplementary Style Guide. These rules are use

An open-source script written in python just for fun

Owersite Owersite is an open-source script written in python just for fun. It do

Loudchecker - Python script to check files for earrape

loudchecker python script to check files for earrape automatically installs depe

EasyMultiClipboard - Python script written to handle more than 1 string in clipboard

EasyMultiClipboard - Python script written to handle more than 1 string in clipboard

A collection of simple python mini projects to enhance your python skills

A collection of simple python mini projects to enhance your python skills

Valentine-with-Python - A Python program generates an animation of a heart with cool texts of your loved one
Valentine-with-Python - A Python program generates an animation of a heart with cool texts of your loved one

Valentine with Python Valentines with Python is a mini fun project I have coded.

Comments
Releases(v4.0.1)
Owner
Mara
Student in Master 2 : Biology, epidemiology and risk gestion. I love roleplay and shitposting. I love conding in python and love learn new things !
Mara
AiiDA plugin for the HyperQueue metascheduler.

aiida-hyperqueue WARNING: This plugin is still in heavy development. Expect bugs to pop up and the API to change. AiiDA plugin for the HyperQueue meta

AiiDA team 3 Jun 19, 2022
Repository for tutorials, examples and starter scripts for using the MTU HPC cluster

MTU-HPC-Starter Repository for tutorials, examples and starter scripts for using the MTU HPC cluster Connecting to the MTU HPC cluster Within the coll

1 Jan 31, 2022
🐱‍🏍 A curated list of awesome things related to Hugo themes.

awesome-hugo-themes Automated deployment @ 2021-10-12 06:24:07 Asia/Shanghai &sorted=updated Theme Author License GitHub Stars Updated Blonde wamo MIT

13 Dec 12, 2022
Convert excel xlsx file's table to csv file, A GUI application on top of python/pyqt and other opensource softwares.

Convert excel xlsx file's table to csv file, A GUI application on top of python/pyqt and other opensource softwares.

David A 0 Jan 20, 2022
This repo contains everything you'll ever need to learn/revise python basics

Python Notes/cheat sheet Simplified notes to get your Python basics right Just compare code and output side by side and feel the rush of enlightenment

Hem 5 Oct 06, 2022
DataRisk Detection Learning Resources

DataRisk Detection Learning Resources Data security: Based on the "data-centric security system" position, it generally refers to the entire security

Liao Wenzhe 59 Dec 05, 2022
Data-Scrapping SEO - the project uses various data scrapping and Google autocompletes API tools to provide relevant points of different keywords so that search engines can be optimized

Data-Scrapping SEO - the project uses various data scrapping and Google autocompletes API tools to provide relevant points of different keywords so that search engines can be optimized; as this infor

Vibhav Kumar Dixit 2 Jul 18, 2022
DataAnalysis: Some data analysis projects in charles_pikachu

DataAnalysis DataAnalysis: Some data analysis projects in charles_pikachu You can star this repository to keep track of the project if it's helpful fo

9 Nov 04, 2022
Bring RGB to life in Neovim

Bring RGB to life in Neovim Change your RGB devices' color depending on Neovim's mode. Fast and asynchronous plugin to live your vim-life to the fulle

Antoine 40 Oct 27, 2022
A powerful Sphinx changelog-generating extension.

What is Releases? Releases is a Python (2.7, 3.4+) compatible Sphinx (1.8+) extension designed to help you keep a source control friendly, merge frien

Jeff Forcier 166 Dec 29, 2022
Modified fork of CPython's ast module that parses `# type:` comments

Typed AST typed_ast is a Python 3 package that provides a Python 2.7 and Python 3 parser similar to the standard ast library. Unlike ast up to Python

Python 217 Dec 06, 2022
This contains timezone mapping information for when preprocessed from the geonames data

when-data This contains timezone mapping information for when preprocessed from the geonames data. It exists in a separate repository so that one does

Armin Ronacher 2 Dec 07, 2021
Some of the best ways and practices of doing code in Python!

Pythonicness ❤ This repository contains some of the best ways and practices of doing code in Python! Features Properly formatted codes (PEP 8) for bet

Samyak Jain 2 Jan 15, 2022
PySpark Cheat Sheet - learn PySpark and develop apps faster

This cheat sheet will help you learn PySpark and write PySpark apps faster. Everything in here is fully functional PySpark code you can run or adapt to your programs.

Carter Shanklin 168 Jan 01, 2023
Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.

datamodel-code-generator This code generator creates pydantic model from an openapi file and others. Help See documentation for more details. Supporte

Koudai Aono 1.3k Dec 29, 2022
Some custom tweaks to the results produced by pytkdocs.

pytkdocs_tweaks Some custom tweaks for pytkdocs. For use as part of the documentation-generation-for-Python stack that comprises mkdocs, mkdocs-materi

Patrick Kidger 4 Nov 24, 2022
Toolchain for project structure and documents optimisation

ritocco Toolchain for project structure and documents optimisation

Harvey Wu 1 Jan 12, 2022
Paper and Code for "Curriculum Learning by Optimizing Learning Dynamics" (AISTATS 2021)

Curriculum Learning by Optimizing Learning Dynamics (DoCL) AISTATS 2021 paper: Title: Curriculum Learning by Optimizing Learning Dynamics [pdf] [appen

Tianyi Zhou 15 Dec 06, 2022
k3heap is a binary min heap implemented with reference

k3heap k3heap is a binary min heap implemented with reference k3heap is a component of pykit3 project: a python3 toolkit set. In this module RefHeap i

pykit3 1 Nov 13, 2021
sphinx builder that outputs markdown files.

sphinx-markdown-builder sphinx builder that outputs markdown files Please ★ this repo if you found it useful ★ ★ ★ If you want frontmatter support ple

Clay Risser 144 Jan 06, 2023