-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
head, header and footer can be specified as a function (#1255)
* rebase & simplify * Update src/markdown.ts Co-authored-by: Mike Bostock <[email protected]> * Update src/config.ts Co-authored-by: Mike Bostock <[email protected]> * no quotes necessary * prettier * combine arguments * document * Update src/config.ts * ignore null and undefined --------- Co-authored-by: Mike Bostock <[email protected]>
- Loading branch information
Showing
6 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
author: Ignored Anonymous | ||
title: Testing fragment functions | ||
date: 2024-04-18 | ||
keywords: [very, much] | ||
--- | ||
|
||
# Display title | ||
|
||
Contents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
head: (data) => `<!-- ${JSON.stringify({fragment: "head", data})} -->`, | ||
header: (data) => `<!-- ${JSON.stringify({fragment: "header", data})} -->`, | ||
footer: (data) => `<!-- ${JSON.stringify({fragment: "footer", data})} -->` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<title>Testing fragment functions</title> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap" crossorigin> | ||
<link rel="preload" as="style" href="./_observablehq/theme-air,near-midnight.css"> | ||
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap" crossorigin> | ||
<link rel="stylesheet" type="text/css" href="./_observablehq/theme-air,near-midnight.css"> | ||
<link rel="modulepreload" href="./_observablehq/client.js"> | ||
<link rel="modulepreload" href="./_observablehq/runtime.js"> | ||
<link rel="modulepreload" href="./_observablehq/stdlib.js"> | ||
<!-- {"fragment":"head","data":{"title":"Testing fragment functions","data":{"title":"Testing fragment functions","keywords":["very","much"]},"path":"/index"}} --> | ||
<script type="module"> | ||
|
||
import "./_observablehq/client.js"; | ||
|
||
</script> | ||
<aside id="observablehq-toc" data-selector="h1:not(:first-of-type)[id], h2:first-child[id], :not(h1) + h2[id]"> | ||
<nav> | ||
</nav> | ||
</aside> | ||
<div id="observablehq-center"> | ||
<header id="observablehq-header"> | ||
<!-- {"fragment":"header","data":{"title":"Testing fragment functions","data":{"title":"Testing fragment functions","keywords":["very","much"]},"path":"/index"}} --> | ||
</header> | ||
<main id="observablehq-main" class="observablehq"> | ||
<h1 id="display-title" tabindex="-1"><a class="observablehq-header-anchor" href="#display-title">Display title</a></h1> | ||
<p>Contents.</p> | ||
</main> | ||
<footer id="observablehq-footer"> | ||
<div><!-- {"fragment":"footer","data":{"title":"Testing fragment functions","data":{"title":"Testing fragment functions","keywords":["very","much"]},"path":"/index"}} --></div> | ||
</footer> | ||
</div> |