···11# Leaflet MD
2233-> ⚠ WARNING ⚠: This project is WIP
33+> [!WARNING]
44+> This project is WIP
4556CLI tool to *transplant* (sync) your Markdown to Leaflet.
67···9101011## Setup
11121212-To set it up you need to create `leaflet-md.config.ts` and default export the config. Here's an example:
1313+To set it up you need to create `leaflet-md.config.[js|ts|mjs|mts]` and default export the config. Here's an example:
1314```typescript
1415import { defineConfig } from "@sharpmars/leaflet-md";
15161617export default defineConfig({
1717- glob: { pattern: "**/*.md", base: "./src/posts" },
1818+ glob: { pattern: "**/*.md", base: "./testing/posts" },
1819 frontmatter: { type: "yaml", titleKey: "title", descriptionKey: "description", uploadDateKey: "uploadedDate" },
2020+ publicationUri: "at://did:plc:irx36xprktslecsbopbwnh5w/pub.leaflet.publication/3m27dfyhhtk2a",
2121+ prependDoc: {
2222+ path: "./testing/leaflet-prepend.md",
2323+ replacement: (key, ctx) => {
2424+ if (key == "slug") return ctx.file.split(".")[0];
2525+ },
2626+ },
1927});
2028```
2929+If you want to use JSON you can create `leaflet-md.config.json` and type in your config in the same way you would in `defineConfig`.
3030+```json
3131+{
3232+ "glob": {
3333+ "pattern": "**/*.md",
3434+ "base": "./testing/posts"
3535+ },
3636+ "frontmatter": {
3737+ "type": "yaml",
3838+ "titleKey": "title",
3939+ "descriptionKey": "description",
4040+ "uploadDateKey": "uploadedDate"
4141+ },
4242+ "publicationUri": "at://did:plc:irx36xprktslecsbopbwnh5w/pub.leaflet.publication/3m27dfyhhtk2a",
4343+ "prependDoc": {
4444+ "path": "./testing/leaflet-prepend.md"
4545+ }
4646+}
4747+```
4848+All options are available [here](https://tangled.org/@sharpmars.nekoweb.org/leaflet-md/blob/main/src/config.ts).
4949+2150Additionally you need to create `.env` file with `BSKY_HANDLE` and `BSKY_PASSW`.
22512323-Mapping between record key and file path is stored in `leaflet-md.map.json`.
5252+Mapping between record keys and file paths is stored in `leaflet-md.map.json`.
24532554## Development
2655