Package: yafpa
This script is intended to be used withYAFPA, a free way to share your obsidian vault.⚠️ The script and site are not a replacement forObsidian Publish, which is a much more efficient way to share Obsidian files.Get StartedYou first need to create a template usingYAFPA-blogAfter, dopip install YAFPAThe first time you use the script, it will ask you three things :Your vault path (absolute path !)The path of the blog (absolute too !)The link of your blog, ashttps://my-awesome-blog.netlify.app/You can reconfigure the path withyafpa --configThe file will be created in your site_package folder.Scriptusage: yafpa [-h] [--preserve | --update] [--filepath FILEPATH] [--git] [--keep] [--config]Create file in folder, move image in assets, convert to relative path, add share support, and push to gitoptional arguments:-h, --help: show this help message and exit--preserve, --p, --P: Don't delete file if already exist--update, --u, --U: force update : delete all file and reform.--filepath FILEPATH, --f FILEPATH, --F FILEPATH: Filepath of the file you want to convert--git, --g, --G: No commit and no push to git--keep, --k: Keep deleted file from vault and removed shared file--config, --c: Edit the config fileChecking differencesThe script will convert all file withshare:trueand check if the contents
are different to the versions in_notes. The only things that are
ignored is the contents of the metadata. If you want absolutely change the
metadata you can:Useyafpa --file <filepath>directlyUse--uto force update all fileContinue to work on the file before pushing it.Add a newlineManually delete the fileAdd or edit the metadata keys (unlessdate/title/created/update/link).⚠️ As always with git, you can repost the exact same file that already exists on the server.Limitations⚠️ In case you have two files with the same name but :In different folderWith different sharing status or folder
The script will bug becauseThe folder is not checked(It's not required). In this unique case, you need to rename one of the files.In the same way, in case you change the folder key in the metadata, you will have two identic file in different folder.OptionsShare allyafpaand allyafpaoption without--F FILEPATHwill automatically read all file in your vault to check theshare: truekey in metadata (frontmatter YAML).By default, the script will check the difference between line(cf checking difference), and convert only the file with difference. You can use--uto force update.Share only a fileThe command will be :yafpa --F filepathThe file to be shared does not need to containshare: truein its YAML, and will be updated no matter what.How it worksThe script :Moves file (withshare: truefrontmatter or specific file) in the_notesfolderMoves image inassets/imgand convert (with alt support)Converts highlight (==mark==to[[mark::highlight]])Converts "normal" writing to GFM markdown (adding\neach\n)Supports non existent file (adding a css for that 😉)Supports image flags css (Lithou snippet 🙏)Support normal and external files (convert "normal markdown link" to
"wikilinks")Edit link to support transluction (if notembed: False)Remove block id (no support)Add CSS settings for inline tags (no link support) ; Tags are : class = .hash ; id = #tag_name (so you can style each tags you use)Frontmatter :  Update the date if there is no date in frontmatterFrontmatter : In absence of title, add the file's title.Copy the link to your clipboard if one file is edited.⭐ Admonition conversion to "callout inspired notion"Update the frontmatter in the original file, adding the link and changeshareto true if one file is shared.Finally, the plugin will add, commit and push if supported.Note : The clipboard may not work in your configuration. I have (and can) only test the script on IOS and Windows, so I usepyperclipandpasteboardto do that. If you are on MacOS, Linux, Android, please, check your configuration on your python and open an issue if it doesn't work.
Note : Ican'ttest on these 3 OSes, so I can't create a clipboard option on my own.Custom CSSYou can add CSS using the filecustom.css. The pluginMarkdown Attributeallow to use the creation of inline css.
Some information about this :You need to add:after the first{The inline IAL work only if there is stylized markdown. In absence, the text will be bolded.It won't work with highlight (removed automatically by the script)⚠️ As I use CodeMirror Options and Contextual Typography, I warn you : the use of#tagsto stylize the text before it doesn't work with my build. So, as an option to don't have a random tag in a text, you can usecustom.cssto remove it withdisplay: none(you can have an example with#left).Frontmatter settingsshare: true: Share the fileembed: false: remove the transluction (convert to normal wikilinks)update: false: Don't update the file at all after the first pushfolder: Use a different folder than_note(here some more information)
Alternatively, you can use thecategorykey :category: folder/categoryfolderis optional ; as default :_notescategorycan befalseto prevent apparence in the feed
NB : ifcategoryandfolderis used at the same time,folderwill be used as the folder.AdmonitionAs admonition is very tricky, I choose to convert all admonition to a "callout Notion".
The script will :Remove codeblock for admonition codeblocksConvert```ad-```to!!!ad-Bold title and add a IAL{: .title}JavaScript will make all things nice.⚠️ As always with markdown, you will see some problem with new paragraph inside admonition. You can use$~$to fake line. The script will automatically add this.
Also, you can add emoji on title to add some nice formatting.Custom AdmonitionYou can now use custom admonition using the filecustom_admonition.yml. The file is formated as a YAML :admonition_type: #In obsidian
  - logo #emoji
  - admonition title: #the name you want in the websiteAdmonition name correspond toadmonition typein the admonition plugin.Admonition title correspond toadmonition titleyou use in the admonition plugin.You need to create multiple key and value for each different synonyme you use (as in admonition...)IOS ShortcutsYou need to found the path of your vault and the blog in your phone. To achieve that, I usea-shell.First, in a-shell, runpickFolderand choose the folder of your vault, and rerunpickFolderto choose the folder where are the blog data (you need to clone withWorking Copy)
After, doshowmarksand copy the two path in any note app. Check if the path is not broken because of the paste!
You can also do :cdshowmarks>bookmark
vimbookmarkHere is a blank sheet to help you if you want to manually write / edit it :vault=
blog_path=
blog=
share=With :vault: Vault Absolute Pathblog_path: Blog repository absolute pathblog: Blog linkshare: your wanted share key ; by default :shareTo use theshortcuts, you need :a-shell(Free)Working CopyBefore running the shortcuts, you need to install all requirements, aka :pip install yafpa
yafpa --CLinks :Share All FileShare One FileFor the moment I can't create a shortcut to share only one file, BUT! You can usea-shellas you do in a normal terminal, aka :jump <vault>
yafpa --f <file>To run the script for all your file, runyafpa.Note : Compared to pyto, the script cannot work with$HOME, so the.YAFPA-envwill be created in the folder you use to run it. It is also possible to use multiple folder, but you need to create the file for each. The better is to have one in the vault ; and one in the default folder of a-shell.Obsidian→ Please use Wikilinks with "short links" (I BEG YOU)
You can integrate the script within obsidian using the nice pluginObsidian ShellCommands.You could create two commands :share all:yafpashare one:yafpa --f {{file_path:absolute}}You can use :Customizable SidebarObsidian Customizable MenuTo have a button to share your file directly in Obsidian !Template frontmatter→ The • indicate that this value is optionaltitle:My files•date:12-11-2021•embed:true•update:true•current:true•flux:true•share:false (this key can be changed in the configuration)category:folder/category (category can be false)description:my awesome fileYou can use MetaEdit / Supercharged links to quickly update the front matter.Exemple of frontmatter :category: Roleplay/Application
date: 21-12-2021
share: true
tag: RP/Darkness-Haunted/Application/PC
title: (Darkness Haunted) Alwyn KallendrisThe file will be added in theRoleplayfolder ; and theApplicationwill now show the file in the sidebar, the Roleplay page and the collections page.