Last active
December 17, 2022 02:19
-
-
Save L-Steinmacher/109d0c279985e956ce7ebe073cc17ff6 to your computer and use it in GitHub Desktop.
A Script Kit script that creates generic markdown files for note taking
This file contains hidden or 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
// Name: Note Generator | |
// Author: Lucas L. Steinmacher | |
import "@johnlindquist/kit" | |
import fs from "fs" | |
/** | |
* select folder that you want the notes to be generated for | |
*/ | |
let folderPath = await selectFolder(); | |
await(hide); | |
/** | |
* tell kit to be working in the same directory as the source folder | |
*/ | |
cd(path.dirname(folderPath)); | |
/** | |
* have the user select how many sessions of notes to generate | |
*/ | |
let sessions = await arg("How many sessions?", [ | |
"1", "2", "3" | |
]); | |
// A simple dictionary to convert sessions to an integer | |
let sessionsDict = { | |
"1": 1, "2": 2, "3": 3 | |
} | |
const noteTemplate = ` | |
## Header here | |
- Putchya' notes here! | |
` | |
const additionalNoteTemplate = ` | |
**Summary** | |
- In this session... | |
**Tools / Concepts / Notable Files** | |
- | |
**Questions for Clarification** | |
- | |
**Additional Content Ideas** | |
- | |
` | |
makeDir(); | |
createFiles(folderPath); | |
/** | |
* tell kit to create new directory for the notes to be created in | |
*/ | |
function makeDir() { | |
fs.mkdir(`${folderPath}-notes`, {recursive:true}, (err) => console.error(err)) | |
} | |
/** | |
* create the Markdown files | |
*/ | |
function createFiles() { | |
let folders = folderPath.split("/") | |
let currFolder = folders[folders.length - 1] | |
if (sessions === "1") { | |
fs.writeFileSync(`${folderPath}-notes/${currFolder}-notes.md`,noteTemplate); | |
fs.writeFileSync(`${folderPath}-notes/${currFolder}-additional-notes.md`, additionalNoteTemplate); | |
} else { | |
for (let i = 1; i <= sessionsDict[sessions]; i++) { | |
fs.writeFileSync(`${folderPath}-notes/${currFolder}-stream${i}-notes.md`,noteTemplate); | |
fs.writeFileSync(`${folderPath}-notes/${currFolder}-stream${i}-additional-notes.md`,additionalNoteTemplate) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment