Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions assets/scss/layouts/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,61 @@ a.docs-link {
font-size: $font-size-base;
}

a.docs-link-agents {
color: $link-color;
font-weight: 700;
margin: 0.5rem 0.75rem 0.25rem 0;
padding: 0.5rem 0.75rem;
box-sizing: border-box;
border-radius: 0.5rem;
background: rgba($link-color, 0.08);
border: 1px solid rgba($link-color, 0.22);
box-shadow: 0 0 0 rgba($link-color, 0);
animation: agents-link-pulse 1.4s ease-in-out infinite;
}

a.docs-link-agents::before {
content: "";
display: inline-block;
width: 0.6rem;
height: 0.6rem;
margin-right: 0.6rem;
border-radius: 50%;
background: currentColor;
box-shadow: 0 0 0.7rem rgba($link-color, 0.65);
vertical-align: middle;
}

@keyframes agents-link-pulse {
0%,
100% {
opacity: 1;
box-shadow: 0 0 0 rgba($link-color, 0);
text-shadow: 0 0 0 rgba($link-color, 0);
}

50% {
opacity: 0.78;
box-shadow: 0 0 0.9rem rgba($link-color, 0.3);
text-shadow: 0 0 0.7rem rgba($link-color, 0.3);
}
}

@media (prefers-reduced-motion: reduce) {
a.docs-link-agents {
animation: none;
}
}

a.docs-link-agents:hover,
a.docs-link-agents:focus-visible {
text-decoration: none;
color: lighten($link-color, 4%);
background: rgba($link-color, 0.14);
border-color: rgba($link-color, 0.34);
box-shadow: 0 0 1rem rgba($link-color, 0.32);
}

.page-links li {
margin-top: 0.375rem;
padding-top: 0.375rem;
Expand Down
9 changes: 9 additions & 0 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ section = ["HTML", "RSS", "SITEMAP"]
suffixes = [""]
delimiter = ""

[mediaTypes."text/markdown"]
suffixes = ["md"]

# add output format for netlify _redirects
[outputFormats.REDIRECTS]
mediaType = "text/netlify"
Expand All @@ -41,6 +44,12 @@ isPlainText = true
noUgly = true
rel = "sitemap"

[outputFormats.AGENTS]
mediaType = "text/markdown"
baseName = "agents"
isPlainText = true
rel = "alternate"

[markup]
[markup.goldmark]
[markup.goldmark.extensions]
Expand Down
2 changes: 1 addition & 1 deletion content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ date: 2020-10-06T08:48:23+00:00
lastmod: 2020-10-06T08:48:23+00:00
draft: false
images: []
outputs: ["HTML", "RSS", "SITEMAP", "AGENTS"]
---

33 changes: 33 additions & 0 deletions layouts/docs/list.agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Reef Docs Agent Export

This route aggregates the raw markdown source for the Reef docs site.
Use the file path and page URL for mapping changes back to the repo.
Each fenced `md` block preserves the source file contents for that document.

{{ $allFiles := partial "main/docs-agent-files.html" (dict "dir" "content/docs" "base" "docs") -}}
{{ $docsIndex := partial "main/docs-agent-entry-data.html" (dict "site" .Site "path" "docs/_index.md") -}}

## Docs Index

{{ partial "main/docs-agent-entry.md" (dict "entry" $docsIndex) -}}
{{ range sort .Site.Menus.docs "Weight" -}}
{{ if gt (len (findRE "^/docs/[^/]+/$" .URL)) 0 -}}
{{ $sectionIndexPath := printf "docs/%s/_index.md" .Identifier -}}
{{ if in $allFiles $sectionIndexPath -}}
{{ $sectionIndex := partial "main/docs-agent-entry-data.html" (dict "site" $.Site "path" $sectionIndexPath) -}}
## {{ .Name }}

{{ partial "main/docs-agent-entry.md" (dict "entry" $sectionIndex) -}}
{{ end -}}
{{ $sectionPrefix := printf "docs/%s/" .Identifier -}}
{{ $entries := slice -}}
{{ range $allFiles -}}
{{ if and (hasPrefix . $sectionPrefix) (ne . $sectionIndexPath) -}}
{{ $entries = $entries | append (partial "main/docs-agent-entry-data.html" (dict "site" $.Site "path" .)) -}}
{{ end -}}
{{ end -}}
{{ range sort $entries "sortKey" -}}
{{ partial "main/docs-agent-entry.md" (dict "entry" .) -}}
{{ end -}}
{{ end -}}
{{ end -}}
3 changes: 2 additions & 1 deletion layouts/docs/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<article>
<h1 class="text-center">{{ .Title }}</h1>
<div class="text-center">{{ .Content }}</div>
<p class="text-center"><a href="{{ "/docs/agents.md" | relURL }}">Open the full raw docs markdown export</a></p>
<div class="card-list">
{{ $currentSection := .CurrentSection }}
{{ range where .Site.RegularPages.ByTitle "Section" .Section }}
Expand All @@ -19,4 +20,4 @@ <h1 class="text-center">{{ .Title }}</h1>
</article>
</div>
</div>
{{ end }}
{{ end }}
31 changes: 31 additions & 0 deletions layouts/partials/main/docs-agent-entry-data.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- $path := .path -}}
{{- $site := .site -}}
{{- $source := readFile (printf "content/%s" $path) -}}
{{- $basename := replaceRE "^.*/" "" $path -}}
{{- $title := title (replace (strings.TrimSuffix ".md" $basename) "-" " ") -}}
{{- $titleMatch := findRE `(?m)^title\s*:\s*"?(.*?)"?\s*$` $source 1 -}}
{{- if gt (len $titleMatch) 0 -}}
{{- $title = replaceRE `(?m)^title\s*:\s*"?(.*?)"?\s*$` "$1" (index $titleMatch 0) -}}
{{- end -}}
{{- $weight := 0 -}}
{{- $weightMatch := findRE `(?m)^weight\s*:\s*(-?[0-9]+)\s*$` $source 1 -}}
{{- if gt (len $weightMatch) 0 -}}
{{- $weight = int (replaceRE `(?m)^weight\s*:\s*(-?[0-9]+)\s*$` "$1" (index $weightMatch 0)) -}}
{{- end -}}
{{- $url := "(not published as a standalone page)" -}}
{{- $scratch := newScratch -}}
{{- range $site.Pages -}}
{{- $page := . -}}
{{- with $page.File -}}
{{- if eq .Path $path -}}
{{- $scratch.Set "page" $page -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with $scratch.Get "page" -}}
{{- $title = .Title -}}
{{- $weight = .Weight -}}
{{- $url = .Permalink -}}
{{- end -}}
{{- $sortKey := printf "%08d|%s|%s" $weight (lower $title) $path -}}
{{- return (dict "path" $path "title" $title "weight" $weight "url" $url "source" $source "sortKey" $sortKey) -}}
14 changes: 14 additions & 0 deletions layouts/partials/main/docs-agent-entry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- $entry := .entry -}}
### {{ $entry.title }}

File: `{{ $entry.path }}`
URL: {{ $entry.url }}

~~~~md
{{ $entry.source }}
~~~~

{{ if eq $entry.url "(not published as a standalone page)" }}
Note: this markdown file lives in the repo but does not generate its own public page.

{{ end }}
14 changes: 14 additions & 0 deletions layouts/partials/main/docs-agent-files.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- $dir := .dir -}}
{{- $base := .base -}}
{{- $files := slice -}}
{{- range readDir $dir -}}
{{- if .IsDir -}}
{{- $nested := partial "main/docs-agent-files.html" (dict "dir" (printf "%s/%s" $dir .Name) "base" (printf "%s/%s" $base .Name)) -}}
{{- range $nested -}}
{{- $files = $files | append . -}}
{{- end -}}
{{- else if strings.HasSuffix .Name ".md" -}}
{{- $files = $files | append (printf "%s/%s" $base .Name) -}}
{{- end -}}
{{- end -}}
{{- return $files -}}
5 changes: 4 additions & 1 deletion layouts/partials/sidebar/docs-menu.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{ $currentPage := . -}}
{{ range .Site.Menus.docs -}}
{{ if eq .Identifier "developers" -}}
<a class="docs-link docs-link-agents" href="{{ "/docs/agents.md" | relURL }}">agents.md</a>
{{ end -}}
<h3>{{ .Name }}</h3>
{{ if .HasChildren -}}
<ul class="list-unstyled">
Expand All @@ -10,4 +13,4 @@ <h3>{{ .Name }}</h3>
{{ end -}}
</ul>
{{ end -}}
{{ end -}}
{{ end -}}