Identifies level 1 headings and selects everything as text for it.
This commit is contained in:
3
build.js
3
build.js
@@ -1,4 +1,5 @@
|
||||
import * as fs from "fs";
|
||||
import { toHtml } from "./markdown.js"
|
||||
|
||||
const paths = {
|
||||
output: ".dist",
|
||||
@@ -36,7 +37,7 @@ manifest.forEach((m) => {
|
||||
let htmlTemplate = fs.readFileSync(notePath, {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
htmlTemplate = htmlTemplate.replace("{{markdown}}", m.markdown);
|
||||
htmlTemplate = htmlTemplate.replace("{{markdown}}", toHtml(m.markdown));
|
||||
fs.writeFileSync(`${paths.output}/${m.directoryName}.html`, htmlTemplate, {
|
||||
encoding: "utf-8",
|
||||
flag: "ax",
|
||||
|
||||
52
markdown.js
52
markdown.js
@@ -1,19 +1,39 @@
|
||||
const toHtml = () => {
|
||||
return `<div>markdown</div>`;
|
||||
export const toHtml = (markdown) => {
|
||||
const symbols = toSymbols(markdown);
|
||||
const html = [];
|
||||
symbols.forEach((s) =>
|
||||
html.push(renderers.find((r) => r.key === s.key).render(s))
|
||||
);
|
||||
|
||||
return `<div>${html.join("\r\n")}</div>`;
|
||||
};
|
||||
|
||||
const singleSymbols = [
|
||||
"#",
|
||||
"##",
|
||||
"###",
|
||||
"####",
|
||||
"#####",
|
||||
"######",
|
||||
"-",
|
||||
"- []",
|
||||
"- [ ]",
|
||||
const toSymbols = (markdown) => {
|
||||
const symbols = [];
|
||||
|
||||
if (heading.symbols.some((s) => markdown.includes(s))) {
|
||||
const symbol = Object.assign({}, heading);
|
||||
symbol.text = markdown;
|
||||
symbols.push(symbol);
|
||||
}
|
||||
|
||||
return symbols;
|
||||
};
|
||||
|
||||
const heading = {
|
||||
key: "heading",
|
||||
level: 1,
|
||||
multiLine: false,
|
||||
symbols: ["#", "##", "###", "####", "#####", "######"],
|
||||
text: "",
|
||||
children: [],
|
||||
};
|
||||
|
||||
const renderers = [
|
||||
{
|
||||
key: "heading",
|
||||
render: (symbol) => {
|
||||
return `<h1>${symbol.text}</h1>`;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const doubleSymbols = ["*", "**", "_", "__", "`", "```"];
|
||||
|
||||
const symbols = {};
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
# Ideas
|
||||
# Creativity while exercising
|
||||
|
||||
This morning I was out for a bike ride
|
||||
_2023-09-16_
|
||||
|
||||
Creative when doing low intensity cardio
|
||||
This morning I was out for a bike ride.
|
||||
|
||||
picture location exif data idea
|
||||
It's something that i really enjoy, and I usually pair it with listening to a couple of episodes from my favorite podcasts (today it was [Syntax](/404)).
|
||||
After 30 minutes or so i find that I usually enter some kind of creative state and zone in and of actually listening to the podcast (if it isn't very interesting) and coming up with project ideas.
|
||||
Today I came up with one that i thought was pretty neat, it most probably already exists in another shape or form.
|
||||
|
||||
forgot the other one?
|
||||
There should be a tool that lets you browse your image library based on location.
|
||||
You index the location exif data from your whole library and plot that on a map.
|
||||
You then draw hotspots on the map where images are present, pressing one reveals the images.
|
||||
|
||||
arstrast
|
||||
Couple this with some nice filtering and perhaps image recognision and it would be pretty neat way to find that picture of that place that you don't really remember where it was physically, but you have a vague recognision of when you took it and what it captured.
|
||||
|
||||
The reason I came up with this is that I sometimes stumble upon beautiful or cool places that I would like to revisit on foot, and while I track my rides with GPS I don't have a system for leaving points of interest to then revisit. Since what I guess is most phones already capture this information, why not put it to good use?
|
||||
|
||||
Reference in New Issue
Block a user