Location of Typora's preference and data / Setting Sync
I found these three dirs in Application support. It's not a big deal, but it's not good behavior for apps to do this:
~Libary/Application Support/Typora
~Libary/Application Support/abnerworks.Typora
~Libary/Application Support/typora-user-images
They can be unified, and setting data and other temp files would be seperated to make setting data easier to sync/backup by sync target folder.
https://github.com/typora/typora-issues/issues/1194
They can be unified, and setting data and other temp files would be seperated to make setting data easier to sync/backup by sync target folder.
Any progress on this?
Bumping. Some of the markdown that is produced out of the gate drives my markdownlint tool crazy. I'd like to setup my json settings to include all the required configuration and ensure macOS and windows both play nice with desired markdown settings. If this has been solved elsewhere let me know, as I see a lot of related issues, but last time i went through them I didn't find a solution.
Hmm.. Currently preferences data also contains some machine-specific configs, like launch location, image location, custom commands, etc
I use Git filters (below) to keep Typora's config files under version control. Don't ask how many hours it took to figure out :wink:
The first is applied to profile.data on Linux and uses xxd to convert the hex-encoded JSON to plain JSON, jsonlint (from demjson) to clean up any invalid syntax, and jq to remove host-specific values and sort/format/normalise the JSON.
The second is applied to abnerworks.Typora.plist on macOS and uses PlistBuddy to perform a similar cleanup.
The effect of these is that plain JSON and XML are committed to the repository while working copies remain encoded on the filesystem.
[filter "typora"]
clean = xxd -r -p | jsonlint -Sf --sort preserve | jq -S --indent 4 'del(.\"sidebar-width\",.customZoom,.initialize_ver,.lastClosedBounds,.lastSavePath,.pinFolder,.sidebar_tab,.uuid,.zoomFactor,.zoomLevel)|.preLinebreakOnExport=false'
smudge = jsonlint -Sf --sort preserve | jq -c | xxd -p | tr -d '\\n'
[filter "typora-plist"]
clean = "! test -x /usr/libexec/PlistBuddy&&cat||{ f=$(mktemp)&&cat >\"$f\"&&for k in ClosedWindowFrame NSNavLastRootDirectory NSNavLastUserSetHideExtensionButtonState NSNavPanelExpandedSizeForOpenMode \"NSWindow Frame _ClosedWindowFrame\" \"NSWindow Frame SUUpdateAlert\" SUHasLaunchedBefore SULastCheckTime SUUpdateRelaunchingMarker currentThemeFolder initialize_ver recentFolder savedLastOpen uuid;do /usr/libexec/PlistBuddy -c \"Delete \\\":$k\\\"\" \"$f\" >&2||:;done&&cat \"$f\"&&rm \"$f\";}"
smudge = cat
For completeness, here are the corresponding .gitattributes lines:
**/[tT]ypora/*.data filter=typora
abnerworks.Typora.plist filter=typora-plist
This is a kludge with multiple points of failure, and recovering from filter errors thrown during staging or checkout can be messy, so I'm not advocating for it (and I definitely don't have time to support it)--but maybe something here will help others figure out interim solutions while we all wait for Typora to write clean, platform-agnostic config files :grinning:
Would also love to see this sorted out. Moreover, it'd be awesome if Typora were to follow XDG basedir spec (on macOS as well) - that'd make config backups and sync using standard tools (like chezmoi) much easier.
I am interested in this as well. I have a git repository with all my notes, and I'd love to be able to save the settings of the editor I use for those notes (typora) inside the repository itself.
Maybe a simple initial implementation would also be check for profile.json and prioritize it over profile.data. Removing the hex (de)coding step would already be a good win.