Skip to content

Commit 3135033

Browse files
authored
use project title for hero (#1364)
1 parent 721ead1 commit 3135033

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

docs/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Now visit <http://127.0.0.1:3000> in your browser, which should look like:
195195

196196
Live preview means that as you save changes, your in-browser preview updates instantly. Live preview applies to Markdown pages, imported JavaScript modules (so-called *hot module replacement*), data loaders, and file attachments. This feature is implemented by the preview server watching files and pushing changes to the browser over a socket.
197197

198-
To experience live preview, open <code>src/index.md</code> in your preferred text editor — below we show Zed — and position your browser window so that you can see your editor and browser side-by-side. If you then replace the text “Hello, Observable Framework” with “Hi, Mom!” and save, you should see:
198+
To experience live preview, open <code>src/index.md</code> in your preferred text editor — below we show Zed — and position your browser window so that you can see your editor and browser side-by-side. If you then replace the text “Hello Framework” with “Hi, Mom!” and save, you should see:
199199

200200
<figure class="wide">
201201
<picture>

src/create.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/no-named-as-default-member */
12
import {exec} from "node:child_process";
23
import {accessSync, existsSync, readdirSync, statSync} from "node:fs";
34
import {constants, copyFile, mkdir, readFile, readdir, stat, writeFile} from "node:fs/promises";
@@ -7,6 +8,7 @@ import {setTimeout as sleep} from "node:timers/promises";
78
import {fileURLToPath} from "node:url";
89
import {promisify} from "node:util";
910
import * as clack from "@clack/prompts";
11+
import he from "he";
1012
import untildify from "untildify";
1113
import wrapAnsi from "wrap-ansi";
1214
import type {ClackEffects} from "./clack.js";
@@ -102,7 +104,7 @@ export async function create(effects: CreateEffects = defaultEffects): Promise<v
102104
runCommand,
103105
installCommand,
104106
rootPath: rootPath!,
105-
projectTitle: projectTitle as string,
107+
projectTitleHtml: he.escape(projectTitle as string),
106108
projectTitleString: JSON.stringify(projectTitle as string),
107109
frameworkVersionString: JSON.stringify(`^${process.env.npm_package_version}`)
108110
},

templates/default/README.md.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ projectTitle }}
1+
# {{ projectTitleHtml }}
22

33
This is an [Observable Framework](https://observablehq.com/framework) project. To start the local preview server, run:
44

templates/default/src/index.md renamed to templates/default/src/index.md.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ toc: false
4545
</style>
4646

4747
<div class="hero">
48-
<h1>Hello, Observable Framework</h1>
48+
<h1>{{ projectTitleHtml }}</h1>
4949
<h2>Welcome to your new project! Edit&nbsp;<code style="font-size: 90%;">src/index.md</code> to change this page.</h2>
5050
<a href="https://observablehq.com/framework/getting-started">Get started<span style="display: inline-block; margin-left: 0.25rem;">↗︎</span></a>
5151
</div>

templates/empty/README.md.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ projectTitle }}
1+
# {{ projectTitleHtml }}
22

33
This is an [Observable Framework](https://observablehq.com/framework) project. To start the local preview server, run:
44

templates/empty/src/index.md.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ projectTitle }}
1+
# {{ projectTitleHtml }}
22

33
This is the home page of your new Observable Framework project.
44

0 commit comments

Comments
 (0)