Jacky Zhao
2023-08-05 7c09627df4bd61e3b4fbd6fd84a1971b40ff72b3
improve hot reload robustness
1 files added
3 files modified
27 ■■■■ changed files
content/features/upcoming features.md 2 ●●● patch | view | raw | blame | history
content/index.md 7 ●●●● patch | view | raw | blame | history
content/migrating from Quartz 3.md patch | view | raw | blame | history
quartz/bootstrap-cli.mjs 18 ●●●●● patch | view | raw | blame | history
content/features/upcoming features.md
@@ -6,6 +6,7 @@
- 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
@@ -14,7 +15,6 @@
- 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
content/index.md
@@ -6,7 +6,9 @@
## ðŸª´ 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
@@ -22,6 +24,9 @@
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
content/migrating from Quartz 3.md
quartz/bootstrap-cli.mjs
@@ -353,9 +353,7 @@
      ],
    })
    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)}`)
@@ -375,20 +373,17 @@
      // 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,
@@ -412,9 +407,10 @@
        })
        .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()
    }
  })