Fixing netlify
This commit is contained in:
parent
9734c0f14c
commit
4133cabd52
@ -8,9 +8,11 @@ indexPage: index
|
||||
`;
|
||||
|
||||
export const INDEX_TEMPLATE =
|
||||
`Hello! And welcome to your brand new SilverBullet space!
|
||||
`This is the index page of your fresh SilverBullet space. It is the default page that is loaded when you open a space.
|
||||
|
||||
For your convenience we're including an on-boarding live template below. Enjoy!
|
||||
|
||||
\`\`\`template
|
||||
page: "[[!silverbullet.md/Getting Started]]"
|
||||
page: "[[!localhost:3001/Getting Started]]"
|
||||
\`\`\`
|
||||
`;
|
||||
|
@ -57,6 +57,11 @@ export class HttpSpacePrimitives implements SpacePrimitives {
|
||||
if (
|
||||
errorMessage.includes("fetch") || errorMessage.includes("load failed")
|
||||
) {
|
||||
console.error(
|
||||
"Got error fetching, throwing offline",
|
||||
url,
|
||||
e.errorMessage,
|
||||
);
|
||||
throw new Error("Offline");
|
||||
}
|
||||
throw e;
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { SETTINGS_TEMPLATE } from "./PAGE_TEMPLATES.ts";
|
||||
import { INDEX_TEMPLATE, SETTINGS_TEMPLATE } from "./PAGE_TEMPLATES.ts";
|
||||
import { YAML } from "./deps.ts";
|
||||
import { SpacePrimitives } from "./spaces/space_primitives.ts";
|
||||
import { expandPropertyNames } from "$sb/lib/json.ts";
|
||||
import type { BuiltinSettings } from "../web/types.ts";
|
||||
import { INDEX_TEMPLATE } from "./PAGE_TEMPLATES.ts";
|
||||
|
||||
/**
|
||||
* Runs a function safely by catching any errors and logging them to the console.
|
||||
|
16
netlify/edge-functions/handle.ts
Normal file
16
netlify/edge-functions/handle.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export default async function handleMarkdown(
|
||||
request: Request,
|
||||
ctx: any,
|
||||
): Promise<Response> {
|
||||
const resp = await ctx.next(request);
|
||||
if (resp.status === 404) {
|
||||
return new Response("", {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "text/markdown" },
|
||||
});
|
||||
} else {
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
export const config = { path: "/*.md" };
|
@ -49,6 +49,8 @@ export async function importLibraryCommand(_def: any, uri?: string) {
|
||||
|
||||
// Write to local space
|
||||
await space.writePage(pageName, new TextDecoder().decode(buf));
|
||||
|
||||
await editor.flashNotification(`Imported ${pageName}`);
|
||||
}
|
||||
await editor.reloadSettingsAndCommands();
|
||||
await editor.flashNotification("Import complete!");
|
||||
|
@ -39,7 +39,6 @@ cat website/_headers | sed "s/12345/$LAST_MODIFIED_TIMESTAMP/g" > website_build/
|
||||
echo "Generating file listing"
|
||||
deno run -A scripts/generate_fs_list.ts > website_build/index.json
|
||||
|
||||
echo > website_build/empty.md
|
||||
|
||||
#echo "Bundling..."
|
||||
deno task bundle
|
||||
|
@ -136,6 +136,11 @@ export class MarkdownWidget extends WidgetType {
|
||||
}
|
||||
|
||||
private attachListeners(div: HTMLElement, buttons?: CodeWidgetButton[]) {
|
||||
div.addEventListener("mousedown", (e) => {
|
||||
// CodeMirror overrides mousedown on parent elements to implement its own selection highlighting.
|
||||
// That's nice, but not for markdown widgets, so let's not propagate the event to CodeMirror here.
|
||||
e.stopPropagation();
|
||||
});
|
||||
// Override wiki links with local navigate (faster)
|
||||
div.querySelectorAll("a[data-ref]").forEach((el_) => {
|
||||
const el = el_ as HTMLElement;
|
||||
|
@ -42,7 +42,7 @@ export class CommandHook extends EventEmitter<CommandHookEvents>
|
||||
|
||||
throttledBuildAllCommands = throttle(() => {
|
||||
this.buildAllCommands().catch(console.error);
|
||||
}, 1000);
|
||||
}, 200);
|
||||
|
||||
async buildAllCommands() {
|
||||
this.editorCommands.clear();
|
||||
|
@ -410,6 +410,10 @@
|
||||
|
||||
.sb-markdown-widget {
|
||||
margin: 0 0 -4ch 0;
|
||||
|
||||
::selection {
|
||||
background-color: var(--editor-selection-background-color) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sb-markdown-top-widget h1,
|
||||
|
@ -1,21 +1,27 @@
|
||||
Welcome to SilverBullet. Since you’re starting fresh, you may want to kick off by importing the [[Library/Core]] [[Libraries|library]] of templates and pages. You can do so easily with the button below. Just push it — you know you want to!
|
||||
# Hello there!
|
||||
Welcome to the wondrous world of SilverBullet. A world that once you discover and appreciate, you’ll never want to leave.
|
||||
|
||||
{[Library: Import|Import Core Library]("!silverbullet.md/Library/Core/")}
|
||||
_One of us!_
|
||||
|
||||
Did that? Let’s proceed.
|
||||
Out of the box SilverBullet is fairly minimal in terms of functionality. To give you a good “first run” experience, we recommend you start by importing the [[Library/Core]] library into your space. This will give you a couple of useful pages, slash commands, page templates and widgets such as [[Table of Contents]] and [[Linked Mentions]] to start of with. If you have no idea what those are — don’t worry about it. Just keep going, you’ll get the hang of things.
|
||||
|
||||
## Getting started
|
||||
The best way to get a good feel for what SilverBullet is to immediately start playing with it. Here are some things for you to try:
|
||||
Just push this button: {[Library: Import|Import Core Library]("!silverbullet.md/Library/Core/")}
|
||||
|
||||
You know you want to.
|
||||
|
||||
Just do it.
|
||||
|
||||
# Next steps
|
||||
Now that you have some basics stuff in place, it’s time to start playing a bit.
|
||||
|
||||
* Click on the page picker (book icon) icon at the top right, or hit `Cmd-k` (Mac) or `Ctrl-k` (Linux and Windows) to open the [[Page Picker]].
|
||||
* Type the name of a non-existent page to create it.
|
||||
* You _can_ create pages in folders (if you’re into that type of thing) simply by putting slashes (`/`) in the name (even on Windows), e.g. `My Folder/My Page`. Don’t worry about that folder existing, we’ll automatically create it if it doesn’t.
|
||||
* Click on the terminal icon (top right), or hit `Cmd-/` (Mac) or `Ctrl-/` (Linux and Windows), or tap the screen with 3 fingers at the same time (on mobile) to open the [[Command Palette]]. The {[Stats: Show]} one is a safe one to try.
|
||||
* Folders are implicitly created by putting slashes (`/`) in the name (even on Windows), e.g. `My Folder/My Page`. Don’t worry about folders existing, we’ll automatically create them if they don’t.
|
||||
* Click on the terminal icon (top right), or hit `Cmd-/` (Mac) or `Ctrl-/` (Linux and Windows), or tap the screen with 3 fingers at the same time (on mobile) to open the [[Command Palette]]. From here you can run various useful and perhaps less useful [[Commands]]. The {[Stats: Show]} one is a safe one to try.
|
||||
* Click on the “T” icon (top right), or hit `Cmd-Shift-t` (Mac) or `Ctrl-Shift-t` (Linux and Windows) to open the [[Template Picker]] and see what templates you have installed (which should be a few after importing the Core library)
|
||||
* Select some text and hit `Alt-m` to ==highlight== it, or `Cmd-b` (Mac) or `Ctrl-b` (Windows/Linux) to make it **bold**, or `Cmd-i` (Mac) or `Ctrl-i` (Windows/Linux) to make it _italic_.
|
||||
* Click a link somewhere on this page to navigate there. When you link to a new page it will initially show up in red (to indicate it does not yet exist), but once you click it — you will create the page automatically (only for real when you actually enter some text).
|
||||
* Start typing `[[` somewhere to insert your own page link (with completion).
|
||||
* [ ] Tap this box 👈 to mark this task as done.
|
||||
* Start typing `:party` to trigger the emoji picker 🎉
|
||||
* Type `/` somewhere in the text to invoke a **slash command**.
|
||||
* If this is matching your personality type, you can click this button {[Editor: Toggle Vim Mode]} to toggle Vim mode. If you cannot figure out how to exit it, just click that button again. _Phew!_
|
||||
@ -35,11 +41,17 @@ page select name order by name limit 10
|
||||
```
|
||||
|
||||
## What next?
|
||||
If you are a visual learner, you may [enjoy this introduction video on Youtube](https://youtu.be/VemS-cqAD5k).
|
||||
If you are a visual learner, you may [enjoy this introduction video on Youtube](https://www.youtube.com/watch?v=BbNbZgOwB-Y).
|
||||
|
||||
Beyond that, you can find more information about SilverBullet on its official website. You have two ways to access it:
|
||||
|
||||
1. Through its [regular website link](https://silverbullet.md/)
|
||||
2. Directly without leaving SilverBullet, through [[Federation]], just click on this: [[SilverBullet]] (note that all of these will be read-only, for obvious reasons)
|
||||
|
||||
To keep up with the latest and greatest going-ons in SilverBullet land, keep an eye on the [[CHANGELOG]].
|
||||
To keep up with the latest and greatest goings-on in SilverBullet land, keep an eye on the [[CHANGELOG]].
|
||||
|
||||
Got any more questions? Join our [community](https://community.silverbullet.md/).
|
||||
|
||||
Feel a bit more ready in this endeavor? If so, feel to remove the [[Live Templates|live template]] that renders this on-boarding description. You’re on your own now.
|
||||
|
||||
You got this.
|
@ -1,3 +1,2 @@
|
||||
# /.fs /index.json 200
|
||||
/.client/* /_client/:splat 200!
|
||||
/* /_client/index.html 200
|
Loading…
Reference in New Issue
Block a user