From fc00ad5bffcd5a1b89a4c1cb19b12d77238cc4c2 Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Fri, 22 Oct 2021 14:04:09 -0700 Subject: [PATCH 1/7] fix for notes with spaces not linking properly --- layouts/_default/single.html | 11 ++++------- layouts/partials/backlinks.html | 10 +++++++--- layouts/partials/graph.html | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c30cd4f..0025cd3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,3 +1,6 @@ + +{{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} +{{$content = replace $content "%20" "-"}} {{ partial "head.html" . }} @@ -13,13 +16,7 @@ {{partial "darkmode.html" .}}
- {{if $.Site.Data.config.enableToc}} - - {{end}} - {{- .Content -}} + {{ $content | safeHTML }}
{{partial "footer.html" .}} diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html index 2e97820..48ffecc 100644 --- a/layouts/partials/backlinks.html +++ b/layouts/partials/backlinks.html @@ -6,9 +6,13 @@ {{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}} {{if $inbound}} {{- range $inbound -}} -
  • - {{index . "source"}} -
  • + {{$src := index . "source"}} + {{$src = replace $src " " "-"}} + {{$src = replace $src `\` ""}} + +
  • + {{index . "source"}} +
  • {{- end -}} {{else}}
  • diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html index 0e9684d..16a9f6a 100644 --- a/layouts/partials/graph.html +++ b/layouts/partials/graph.html @@ -126,7 +126,7 @@ .attr("fill", color) .style("cursor", "pointer") .on("click", (_, d) => { - window.location.href = {{.Site.BaseURL}} + d.id; + window.location.href = {{.Site.BaseURL}} + d.id.replace(" ", "-"); }) .on("mouseover", function (_, d) { d3.selectAll(".node") @@ -184,7 +184,7 @@ const labels = graphNode.append("text") .attr("dx", 12) .attr("dy", ".35em") - .text((d) => d.id) + .text((d) => d.id.replace("%20", "-")) .style("opacity", 0) .style("pointer-events", "none") .call(drag(simulation)); From 776ef084c9c98163f96cce62621cb8b0cf59bbdd Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Fri, 22 Oct 2021 18:32:57 -0700 Subject: [PATCH 2/7] fix last commit --- layouts/_default/single.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0025cd3..9193ee6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,6 @@ - {{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} {{$content = replace $content "%20" "-"}} +{{$content = $content | safeHTML}} {{ partial "head.html" . }} @@ -16,7 +16,13 @@ {{partial "darkmode.html" .}}
    - {{ $content | safeHTML }} + {{if $.Site.Data.config.enableToc}} + + {{end}} + {{- $content -}}
    {{partial "footer.html" .}} From e1366ecb6173b7c5e799c46e3ed8acbb50aaf447 Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Fri, 22 Oct 2021 18:56:26 -0700 Subject: [PATCH 3/7] fix accidental code --- layouts/partials/backlinks.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html index 48ffecc..16b96cd 100644 --- a/layouts/partials/backlinks.html +++ b/layouts/partials/backlinks.html @@ -8,10 +8,9 @@ {{- range $inbound -}} {{$src := index . "source"}} {{$src = replace $src " " "-"}} - {{$src = replace $src `\` ""}}
  • - {{index . "source"}} + {{index . "source"}}
  • {{- end -}} {{else}} From 8eca1e60f78f40d6b598aa397bb315adfc53d9ad Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Tue, 26 Oct 2021 12:36:20 -0700 Subject: [PATCH 4/7] change %20 in node labels to whitespace, change %20 in node hrefs to hyphen --- layouts/index.html | 5 ++++- layouts/partials/graph.html | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index fdc03b1..73c5979 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -3,10 +3,13 @@ {{end}} {{define "main"}} +{{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} +{{$content = replace $content "%20" "-"}} +{{$content = $content | safeHTML}}
    {{partial "darkmode.html" .}} - {{.Content}} + {{$content}}
    diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html index 16a9f6a..d10c7f5 100644 --- a/layouts/partials/graph.html +++ b/layouts/partials/graph.html @@ -126,7 +126,7 @@ .attr("fill", color) .style("cursor", "pointer") .on("click", (_, d) => { - window.location.href = {{.Site.BaseURL}} + d.id.replace(" ", "-"); + window.location.href = {{.Site.BaseURL}} + d.id.replace(" ", "-").replace("%20", "-"); }) .on("mouseover", function (_, d) { d3.selectAll(".node") @@ -184,7 +184,7 @@ const labels = graphNode.append("text") .attr("dx", 12) .attr("dy", ".35em") - .text((d) => d.id.replace("%20", "-")) + .text((d) => d.id.replace("%20", " ")) .style("opacity", 0) .style("pointer-events", "none") .call(drag(simulation)); From e0535dbe3219e297945284ca2af9862bd457a893 Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Tue, 26 Oct 2021 12:43:55 -0700 Subject: [PATCH 5/7] fix conflict --- content/_index.md | 2 +- content/moc/{directory.md => direc tory.md} | 0 layouts/index.html | 40 +++++++++++++-------- 3 files changed, 27 insertions(+), 15 deletions(-) rename content/moc/{directory.md => direc tory.md} (100%) diff --git a/content/_index.md b/content/_index.md index b665a3d..657cb17 100644 --- a/content/_index.md +++ b/content/_index.md @@ -20,4 +20,4 @@ I was really inspired by [Bianca](https://garden.bianca.digital/) and [Joel](htt ## Get Started The entire Quartz documentation is fully hosted using Quartz! To get started, let's visit the main directory. -👉 [Directory](moc/directory.md) \ No newline at end of file +👉 [Directory](moc/direc%20tory.md) \ No newline at end of file diff --git a/content/moc/directory.md b/content/moc/direc tory.md similarity index 100% rename from content/moc/directory.md rename to content/moc/direc tory.md diff --git a/layouts/index.html b/layouts/index.html index 73c5979..6f7725b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,19 +1,31 @@ -{{define "head"}} -{{ partial "head.html" . }} -{{end}} - -{{define "main"}} {{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} {{$content = replace $content "%20" "-"}} {{$content = $content | safeHTML}} - -
    - {{partial "darkmode.html" .}} - {{$content}} + + +{{ partial "head.html" . }} - -
    - {{partial "footer.html" .}} -
    + +{{partial "search.html" .}} +
    + +
    + {{if .Title}}

    {{ .Title }}

    {{end}} + Search IconIcon to open search +
    + {{partial "darkmode.html" .}} +
    +
    + {{if $.Site.Data.config.enableToc}} + + {{end}} + {{- $content -}} +
    + {{partial "footer.html" .}}
    -{{end}} + + + \ No newline at end of file From a14d06aa3d37396531dbfe09bb3b18b7eb9b96ad Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Tue, 26 Oct 2021 12:44:25 -0700 Subject: [PATCH 6/7] fix conflict fix --- content/_index.md | 2 +- content/moc/{direc tory.md => directory.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename content/moc/{direc tory.md => directory.md} (100%) diff --git a/content/_index.md b/content/_index.md index 657cb17..b665a3d 100644 --- a/content/_index.md +++ b/content/_index.md @@ -20,4 +20,4 @@ I was really inspired by [Bianca](https://garden.bianca.digital/) and [Joel](htt ## Get Started The entire Quartz documentation is fully hosted using Quartz! To get started, let's visit the main directory. -👉 [Directory](moc/direc%20tory.md) \ No newline at end of file +👉 [Directory](moc/directory.md) \ No newline at end of file diff --git a/content/moc/direc tory.md b/content/moc/directory.md similarity index 100% rename from content/moc/direc tory.md rename to content/moc/directory.md From 9292de63336da42651c646253ef6000621d5328b Mon Sep 17 00:00:00 2001 From: Blake Allen Date: Tue, 26 Oct 2021 16:58:08 -0700 Subject: [PATCH 7/7] remove unnecessary regex, use encodeuri for label instead of replace --- layouts/_default/_markup/render-link.html | 1 + layouts/_default/single.html | 5 +---- layouts/index.html | 5 +---- layouts/partials/backlinks.html | 2 +- layouts/partials/graph.html | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 0288029..f37614f 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,4 +1,5 @@ {{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}} +{{$trimmed = replace $trimmed "%20" "-"}} {{$external := strings.HasPrefix $trimmed "http" }} {{ if $external }} {{ .Text | safeHTML }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9193ee6..9f6443d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,3 @@ -{{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} -{{$content = replace $content "%20" "-"}} -{{$content = $content | safeHTML}} {{ partial "head.html" . }} @@ -22,7 +19,7 @@ {{ .TableOfContents }} {{end}} - {{- $content -}} + {{.Content}} {{partial "footer.html" .}}
    diff --git a/layouts/index.html b/layouts/index.html index 6f7725b..6496b6f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,3 @@ -{{$content := replaceRE `a href="\.\.\/(.+%20.+)+"` `$1` .Content}} -{{$content = replace $content "%20" "-"}} -{{$content = $content | safeHTML}} {{ partial "head.html" . }} @@ -22,7 +19,7 @@ {{ .TableOfContents }} {{end}} - {{- $content -}} + {{- .Content -}} {{partial "footer.html" .}}
    diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html index 16b96cd..744f7e3 100644 --- a/layouts/partials/backlinks.html +++ b/layouts/partials/backlinks.html @@ -10,7 +10,7 @@ {{$src = replace $src " " "-"}}
  • - {{index . "source"}} + {{index . "source"}}
  • {{- end -}} {{else}} diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html index d10c7f5..d529e8d 100644 --- a/layouts/partials/graph.html +++ b/layouts/partials/graph.html @@ -184,7 +184,7 @@ const labels = graphNode.append("text") .attr("dx", 12) .attr("dy", ".35em") - .text((d) => d.id.replace("%20", " ")) + .text((d) => encodeURI(d.id)) .style("opacity", 0) .style("pointer-events", "none") .call(drag(simulation));