Addresses the issue mentioned in
https://github.com/denoland/fresh/pull/3163#discussion_r2246708003.
The issue was that the `raw` markdown was being used for e.g. `## My
title`, thus the slug became `-my-title` instead of `my-title`. Slugs
were working correctly for `codespan` in headers, e.g. ``## `someCode`
``.
I decided to hard error if unexpected heading syntax is used over
sluggifying unexpected content (can become super weird otherwise, e.g.
`## <button ...>My heading</button>`). I can revert to fallbacking to
`raw` if preferred, but perhaps with at least trimming leading `-` just
in case.
Follow-up from #3162.
This PR does various tweaks, mostly related to code blocks.
- Adds missing titles to code blocks, and updates titles to be more
consistent
- Adds filenames to most ` ```tsx` blocks with e.g. `main.ts`, `dev.ts`
or a suitable example (e.g. `routes/greeting.tsx`) based on the code
- Adds filenames to ` ```diff` blocks if there's a relevant file, to
make the icon e.g. TS over Diff icon
- Code blocks with Fresh code (e.g. interfaces) uses ` ```tsx fresh 🍋`
- Changes most ` ```sh` blocks with example terminal commands to ` ```sh
Terminal`
- Updates ` ```txt Project Structure` or ` ```diff Project Structure`
blocks to be more consistent
- Changes `sh` or `txt` to `txt-files` which improves highlighting and
makes icon consistent
- Renames `<project dir>` to `<project root>` to match builder `root`
option terminology
- Adds `<project root>` root folder to most/all overview folder
overviews
- Makes the structure blocks more consistently displayed
- Tried to make some "bare" examples more complete
## Comparison
Here's a small curated set of before/after changes.
### Deployment
- `deno` highlighted in terminal commands
- `.gitignore` syntax highlighting works without using `sh` as language
<img width="1641" height="1009" alt="image"
src="https://github.com/user-attachments/assets/170cf833-1f6a-4b0d-8d2d-a081bc28a967"
/>
### File routing
Updated icon, comments same as before, but root and hierarchy have new
colors (`operator`/`function`).
<img width="1647" height="588" alt="image"
src="https://github.com/user-attachments/assets/f28db51b-4bee-45e4-be1c-e137a6d3ae3d"
/>
We can improve cold start times by only loading route modules when the particular pattern matches. This PR introduces the concept of lazy middlewares, routes and handlers to do that.
- Refactor screenshot functionality into testable utility functions
- Add comprehensive test suite to catch regressions early
- Ensure functionality doesn't break unexpectedly without notification
--patch-1
based on review, make throw error naturally
---------
Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
The relevant dependencies were lost in previous cleanups. This situation
caused the screenshot function to fail.
This PR properly cleans up the functional function and restores its
operation.
---------
Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
due to resolves the `NotFound: No such file or directory` error in the
`www/utils/screenshot.ts` script, which was caused by improper file path
construction. This error prevented screenshots from being saved
correctly. close#2919
-- update --patch1
## Current Status
- Using npm:puppeteer for webpage screenshots
- npm lifecycle script warnings present
- deno-puppeteer is no longer maintained
- npm:puppeteer still has compatibility issues
## References
- [astral](https://github.com/lino-levan/astral): Browser automation
library designed for Deno
-
[deno-puppeteer#92](https://github.com/lucacasonato/deno-puppeteer/issues/92):
Recent discussion about deno-puppeteer
## Changes Made
1. Dependency Replacement
- Replaced npm:puppeteer with jsr:@astral/astral
- Removed npm lifecycle script warnings
2. Dependency Management Optimization
- Centralized all imports in deno.json
- Using jsr: and URL imports
## Testing Steps
1. Run screenshot command:
```bash
deno task screenshot https://google.com google
```
2. Check output:
- Verify no npm warnings
- Validate generated image files:
- ./www/static/showcase/google2x.jpg
- ./www/static/showcase/google1x.jpg
- Confirm image quality
3. Run complete test suite:
```bash
deno task ok
```
- Ensure all tests pass
4. Verify functionality:
- Screenshot feature works correctly
- Image processing (2x/1x) functions properly
---------
Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Overhauls the Fresh homepage with a new design, new demos, and new
sections highlighting Fresh's capabilities.
---------
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
closes https://github.com/denoland/fresh/issues/2319
The issue is because `imports.ts` wasn't changed before releasing. I
thought I would go through and bump some other versions as well. This
handles everything except the esbuild stuff and `tests/`.