diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0de29389 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +public +resources +.idea +content/.obsidian \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..147e2ca1 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 jackyzha0 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..0666d7b9 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# quartz +Simple second brain and digital garden. + +```shell +# Installation +go install github.com/jackyzha0/hugo-obsidian + +# Run +hugo-obsidian -input=content -output=data +``` \ No newline at end of file diff --git a/assets/darkmode.js b/assets/darkmode.js new file mode 100644 index 00000000..93bf6dac --- /dev/null +++ b/assets/darkmode.js @@ -0,0 +1,26 @@ +// Darkmode toggle +const toggleSwitch = document.querySelector('#darkmode-toggle') + +const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark' +const currentTheme = localStorage.getItem('theme') ?? userPref + +if (currentTheme) { + document.documentElement.setAttribute('saved-theme', currentTheme); + if (currentTheme === 'dark') { + toggleSwitch.checked = true + } +} + +const switchTheme = (e) => { + if (e.target.checked) { + document.documentElement.setAttribute('saved-theme', 'dark') + localStorage.setItem('theme', 'dark') + } + else { + document.documentElement.setAttribute('saved-theme', 'light') + localStorage.setItem('theme', 'light') + } +} + +// listen for toggle +toggleSwitch.addEventListener('change', switchTheme, false) \ No newline at end of file diff --git a/assets/darkmode.scss b/assets/darkmode.scss new file mode 100644 index 00000000..dde5be66 --- /dev/null +++ b/assets/darkmode.scss @@ -0,0 +1,67 @@ + +.darkmode { + text-align: right; + + & > .toggle { + display: none; + box-sizing: border-box; + + &:checked + .toggle-button:after { + left: 50%; + } + + & + .toggle-button { + box-sizing: border-box; + outline: 0; + display: inline-block; + width: 3em; + height: 1.5em; + position: relative; + cursor: pointer; + border: 2px solid var(--gray); + user-select: none; + padding: 2px; + transition: all 0.2s ease; + border-radius: 2em; + + &:after, &:before { + position: relative; + display: block; + box-sizing: border-box; + content: ""; + width: 50%; + height: 100%; + } + + &:before { + display: none; + } + + &:after { + left: 0; + transition: all 0.2s ease; + background: var(--gray); + content: ""; + border-radius: 1em; + } + } + } + + & #dayIcon { + position: relative; + width: 20px; + height: 20px; + top: -1.5px; + margin: 0 7px; + fill: var(--gray); + } + + & #nightIcon { + position: relative; + width: 18px; + height: 18px; + top: -2px; + margin: 0 7px; + fill: var(--gray); + } +} \ No newline at end of file diff --git a/assets/syntax.scss b/assets/syntax.scss new file mode 100644 index 00000000..27c37f4b --- /dev/null +++ b/assets/syntax.scss @@ -0,0 +1,99 @@ +/* Background */ .chroma { color: #f8f8f2; background-color: #282a36 } +/* Other */ .chroma .x { } +/* Error */ .chroma .err { } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } +/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } +/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* Keyword */ .chroma .k { color: #ff79c6 } +/* KeywordConstant */ .chroma .kc { color: #ff79c6 } +/* KeywordDeclaration */ .chroma .kd { color: #8be9fd; font-style: italic } +/* KeywordNamespace */ .chroma .kn { color: #ff79c6 } +/* KeywordPseudo */ .chroma .kp { color: #ff79c6 } +/* KeywordReserved */ .chroma .kr { color: #ff79c6 } +/* KeywordType */ .chroma .kt { color: #8be9fd } +/* Name */ .chroma .n { } +/* NameAttribute */ .chroma .na { color: #50fa7b } +/* NameBuiltin */ .chroma .nb { color: #8be9fd; font-style: italic } +/* NameBuiltinPseudo */ .chroma .bp { } +/* NameClass */ .chroma .nc { color: #50fa7b } +/* NameConstant */ .chroma .no { } +/* NameDecorator */ .chroma .nd { } +/* NameEntity */ .chroma .ni { } +/* NameException */ .chroma .ne { } +/* NameFunction */ .chroma .nf { color: #50fa7b } +/* NameFunctionMagic */ .chroma .fm { } +/* NameLabel */ .chroma .nl { color: #8be9fd; font-style: italic } +/* NameNamespace */ .chroma .nn { } +/* NameOther */ .chroma .nx { } +/* NameProperty */ .chroma .py { } +/* NameTag */ .chroma .nt { color: #ff79c6 } +/* NameVariable */ .chroma .nv { color: #8be9fd; font-style: italic } +/* NameVariableClass */ .chroma .vc { color: #8be9fd; font-style: italic } +/* NameVariableGlobal */ .chroma .vg { color: #8be9fd; font-style: italic } +/* NameVariableInstance */ .chroma .vi { color: #8be9fd; font-style: italic } +/* NameVariableMagic */ .chroma .vm { } +/* Literal */ .chroma .l { } +/* LiteralDate */ .chroma .ld { } +/* LiteralString */ .chroma .s { color: #f1fa8c } +/* LiteralStringAffix */ .chroma .sa { color: #f1fa8c } +/* LiteralStringBacktick */ .chroma .sb { color: #f1fa8c } +/* LiteralStringChar */ .chroma .sc { color: #f1fa8c } +/* LiteralStringDelimiter */ .chroma .dl { color: #f1fa8c } +/* LiteralStringDoc */ .chroma .sd { color: #f1fa8c } +/* LiteralStringDouble */ .chroma .s2 { color: #f1fa8c } +/* LiteralStringEscape */ .chroma .se { color: #f1fa8c } +/* LiteralStringHeredoc */ .chroma .sh { color: #f1fa8c } +/* LiteralStringInterpol */ .chroma .si { color: #f1fa8c } +/* LiteralStringOther */ .chroma .sx { color: #f1fa8c } +/* LiteralStringRegex */ .chroma .sr { color: #f1fa8c } +/* LiteralStringSingle */ .chroma .s1 { color: #f1fa8c } +/* LiteralStringSymbol */ .chroma .ss { color: #f1fa8c } +/* LiteralNumber */ .chroma .m { color: #bd93f9 } +/* LiteralNumberBin */ .chroma .mb { color: #bd93f9 } +/* LiteralNumberFloat */ .chroma .mf { color: #bd93f9 } +/* LiteralNumberHex */ .chroma .mh { color: #bd93f9 } +/* LiteralNumberInteger */ .chroma .mi { color: #bd93f9 } +/* LiteralNumberIntegerLong */ .chroma .il { color: #bd93f9 } +/* LiteralNumberOct */ .chroma .mo { color: #bd93f9 } +/* Operator */ .chroma .o { color: #ff79c6 } +/* OperatorWord */ .chroma .ow { color: #ff79c6 } +/* Punctuation */ .chroma .p { } +/* Comment */ .chroma .c { color: #6272a4 } +/* CommentHashbang */ .chroma .ch { color: #6272a4 } +/* CommentMultiline */ .chroma .cm { color: #6272a4 } +/* CommentSingle */ .chroma .c1 { color: #6272a4 } +/* CommentSpecial */ .chroma .cs { color: #6272a4 } +/* CommentPreproc */ .chroma .cp { color: #ff79c6 } +/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 } +/* Generic */ .chroma .g { } +/* GenericDeleted */ .chroma .gd { color: #8b080b } +/* GenericEmph */ .chroma .ge { text-decoration: underline } +/* GenericError */ .chroma .gr { } +/* GenericHeading */ .chroma .gh { font-weight: bold } +/* GenericInserted */ .chroma .gi { font-weight: bold } +/* GenericOutput */ .chroma .go { color: #44475a } +/* GenericPrompt */ .chroma .gp { } +/* GenericStrong */ .chroma .gs { } +/* GenericSubheading */ .chroma .gu { font-weight: bold } +/* GenericTraceback */ .chroma .gt { } +/* GenericUnderline */ .chroma .gl { text-decoration: underline } +/* TextWhitespace */ .chroma .w { } + +.lntd:first-of-type > .chroma { + padding-right: 0; +} + +.chroma code { + font-family: 'Fira Code' !important; + font-size: 0.85em; + line-height: 1em; + background: none; + padding: 0; +} + +.chroma { + border-radius: 3px; + margin: 0; +} \ No newline at end of file diff --git a/config.toml b/config.toml new file mode 100644 index 00000000..da90bbfd --- /dev/null +++ b/config.toml @@ -0,0 +1,4 @@ +baseURL = "https://quartz.jzhao.xyz/" +languageCode = "en-us" +googleAnalytics = "UA-148413215-1" +pygmentsUseClasses = true \ No newline at end of file diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 00000000..e69de29b diff --git a/content/moc/directory.md b/content/moc/directory.md new file mode 100644 index 00000000..e69de29b diff --git a/content/notes/config.md b/content/notes/config.md new file mode 100644 index 00000000..e69de29b diff --git a/content/notes/setup.md b/content/notes/setup.md new file mode 100644 index 00000000..e69de29b diff --git a/content/notes/troubleshooting.md b/content/notes/troubleshooting.md new file mode 100644 index 00000000..e69de29b diff --git a/content/notes/welcome.md b/content/notes/welcome.md new file mode 100644 index 00000000..e69de29b diff --git a/data/config.yaml b/data/config.yaml new file mode 100644 index 00000000..8d0ae8aa --- /dev/null +++ b/data/config.yaml @@ -0,0 +1,11 @@ +name: Quartz Example Page +description: + Here is the page description. This is an example Quartz site that details installation, + setup, customization, and troubleshooting for Quartz itself. +page_title: + Quartz Example Page +links: + - link_name: twitter + link: https://twitter.com/_jzhao + - link_name: github + link: https://github.com/jackyzha0 \ No newline at end of file diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml new file mode 100644 index 00000000..089d5d30 --- /dev/null +++ b/data/graphConfig.yaml @@ -0,0 +1,11 @@ +enableLegend: false +enableDrag: true +enableZoom: false +base: + node: "#284b63" + activeNode: "#f28482" + inactiveNode: "#a8b3bd" + link: "#babdbf" + activeLink: "#5a7282" +paths: + - /moc: "#4388cc" \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 00000000..e69de29b diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 00000000..ccb3b93a --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,10 @@ + + +{{ block "head" . }} +{{ end }} + + +{{ block "main" . }} +{{ end }} + + \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 00000000..c7ce8819 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,24 @@ + + +{{ partial "head.html" . }} + + +
+ + {{partial "darkmode.html" .}} +
+ {{if .Title}}

{{ .Title }}

{{end}} + {{- .Content -}} +
+ {{partial "footer.html" .}} +
+ +{{- with resources.Get "darkmode.js" | minify -}} + +{{- end -}} + + + + \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 00000000..e69de29b diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html new file mode 100644 index 00000000..2ae49760 --- /dev/null +++ b/layouts/partials/backlinks.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/layouts/partials/darkmode.html b/layouts/partials/darkmode.html new file mode 100644 index 00000000..3d36d9a1 --- /dev/null +++ b/layouts/partials/darkmode.html @@ -0,0 +1,16 @@ +
+ + + + +
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 00000000..3afeb8e7 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,21 @@ +
+
+ {{partial "graph.html" .}} + +
+ + +
+ +
\ No newline at end of file diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html new file mode 100644 index 00000000..ea9cf1a1 --- /dev/null +++ b/layouts/partials/graph.html @@ -0,0 +1,218 @@ + +
+ + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 00000000..5e42a2cf --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,24 @@ + + + + {{ template "_internal/google_analytics_async.html" . }} + + + + + {{$.Site.Data.config.page_title}} + + + + + + {{ $css := slice "darkmode.scss" "syntax.scss"}} + {{range $css}} + {{$sass := resources.Get . | resources.ToCSS }} + {{with $sass | minify}} + + {{end}} + {{end}} + \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 00000000..e69de29b diff --git a/static/icon.png b/static/icon.png new file mode 100644 index 00000000..7294a8b2 Binary files /dev/null and b/static/icon.png differ