From c942c5e09d866a18b9ccd48125009378e9e16ac7 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 c30cd4fe..0025cd31 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 2e978202..48ffecc4 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 0e9684d6..16a9f6a1 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 b1b2913834fbe836b6ab5e13ea0958963be1b295 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 0025cd31..9193ee62 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 a50c87d1cda5aa1e485cbd16529b994bb66edff0 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 48ffecc4..16b96cdf 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 786d5d84f2636848f280b8aedcadb947862efc64 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 fdc03b1f..73c59794 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 16a9f6a1..d10c7f5e 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 4e2f8eb96a5c0500d837b23143829a626e585cfc 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 b665a3de..657cb17b 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 73c59794..6f7725bf 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 7f9f9dca8ae4fa3bfea471d49051a3e38844d563 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 657cb17b..b665a3de 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 c457f0af605c908bd7ca13eadbc5fb7f7bcd587c 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 0288029d..f37614f0 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 9193ee62..9f6443d1 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 6f7725bf..6496b6fe 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 16b96cdf..744f7e36 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 d10c7f5e..d529e8d8 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));