improve hot reload robustness
1 files added
3 files modified
| | |
| | | |
| | | - block links: https://help.obsidian.md/Linking+notes+and+files/Internal+links#Link+to+a+block+in+a+note |
| | | - note/header/block transcludes: https://help.obsidian.md/Linking+notes+and+files/Embedding+files |
| | | - static dead link detection |
| | | |
| | | ## misc |
| | | |
| | |
| | | - recent notes component |
| | | - cursor chat extension |
| | | - https://giscus.app/ extension |
| | | - custom md blocks (e.g. for poetry) |
| | | - sidenotes? https://github.com/capnfabs/paperesque |
| | | - direct match in search using double quotes |
| | | - https://help.obsidian.md/Advanced+topics/Using+Obsidian+URI |
| | |
| | | |
| | | ## 🪴 Get Started |
| | | |
| | | Quartz requires **at least [Node](https://nodejs.org/) v18.14** to function correctly. In your terminal of choice, enter the following commands line by line: |
| | | Quartz requires **at least [Node](https://nodejs.org/) v18.14** to function correctly. Ensure you have this installed on your machine before continuing. |
| | | |
| | | Then, in your terminal of choice, enter the following commands line by line: |
| | | |
| | | ```shell |
| | | git clone https://github.com/jackyzha0/quartz.git |
| | |
| | | |
| | | Then, when you're ready, see how to [[build]] and [[hosting|host]] Quartz. |
| | | |
| | | > [!info] |
| | | > Coming from Quartz 3? See the [[migrating from Quartz 3|migration guide]] for the differences between Quartz 3 and Quartz 4 and how to migrate. |
| | | |
| | | ## 🔧 Features |
| | | |
| | | - [[full-text search|Full-text search]], [[graph view]], [[backlinks]], [[Latex]], [[syntax highlighting]], [[popover previews]], and many more right out of the box |
| | |
| | | ], |
| | | }) |
| | | |
| | | let clientRefresh = () => {} |
| | | let closeHandler = null |
| | | const build = async () => { |
| | | const build = async (clientRefresh) => { |
| | | const result = await ctx.rebuild().catch((err) => { |
| | | console.error(`${chalk.red("Couldn't parse Quartz configuration:")} ${fp}`) |
| | | console.log(`Reason: ${chalk.grey(err)}`) |
| | |
| | | |
| | | // bypass module cache |
| | | const { default: buildQuartz } = await import(cacheFile + `?update=${new Date()}`) |
| | | if (closeHandler) { |
| | | await closeHandler() |
| | | } |
| | | |
| | | closeHandler = await buildQuartz(argv, clientRefresh) |
| | | await buildQuartz(argv, clientRefresh) |
| | | clientRefresh() |
| | | } |
| | | |
| | | await build() |
| | | if (argv.serve) { |
| | | const wss = new WebSocketServer({ port: 3001 }) |
| | | const connections = [] |
| | | wss.on("connection", (ws) => connections.push(ws)) |
| | | clientRefresh = () => connections.forEach((conn) => conn.send("rebuild")) |
| | | const clientRefresh = () => connections.forEach((conn) => conn.send("rebuild")) |
| | | |
| | | await build(clientRefresh) |
| | | const server = http.createServer(async (req, res) => { |
| | | await serveHandler(req, res, { |
| | | public: argv.output, |
| | |
| | | }) |
| | | .on("all", async () => { |
| | | console.log(chalk.yellow("Detected a source code change, doing a hard rebuild...")) |
| | | await build() |
| | | await build(clientRefresh) |
| | | }) |
| | | } else { |
| | | await build(() => {}) |
| | | ctx.dispose() |
| | | } |
| | | }) |