mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-08 05:35:20 +00:00
Handle themes not adhering to obsidian v1
This commit is contained in:
parent
6b1460d0c0
commit
9d2eed43d1
@ -4,8 +4,22 @@ const axios = require("axios");
|
|||||||
|
|
||||||
module.exports = async() => {
|
module.exports = async() => {
|
||||||
let themeStyle = "";
|
let themeStyle = "";
|
||||||
if (process.env.THEME) {
|
let themeUrl = process.env.THEME;
|
||||||
const res = await axios.get(process.env.THEME)
|
if (themeUrl) {
|
||||||
|
//https://forum.obsidian.md/t/1-0-theme-migration-guide/42537
|
||||||
|
//Not all themes with no legacy mark have a theme.css file, so we need to check for it
|
||||||
|
try{
|
||||||
|
await axios.get(themeUrl);
|
||||||
|
}catch{
|
||||||
|
if(themeUrl.indexOf("theme.css") > -1){
|
||||||
|
themeUrl = themeUrl.replace("theme.css", "obsidian.css");
|
||||||
|
}
|
||||||
|
else if(themeUrl.indexOf("obsidian.css") > -1){
|
||||||
|
themeUrl = themeUrl.replace("obsidian.css", "theme.css");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await axios.get(themeUrl);
|
||||||
themeStyle = `<style>${res.data}</style>`;
|
themeStyle = `<style>${res.data}</style>`;
|
||||||
}
|
}
|
||||||
const meta ={
|
const meta ={
|
||||||
|
Loading…
x
Reference in New Issue
Block a user