Commit Graph

58 Commits (f519152465dc1caa125d3d220c8f370316035dde)

Author SHA1 Message Date
Peter Cai f519152465
integrate hljs into backend to provide code highlighting
1. Use hljs and wasm_bindgen to parse code
2. Allow the final user to choose what language to include by generating
   inline_js in for #[wasm_bindgen] (a thin wrapper around the
   raw hljs to load whatever is needed by config.json statically rather
   than dynamically)
3. Integrate the monokai color scheme into our default theme
2020-04-12 16:53:51 +08:00
Peter Cai 26bb98b11e
blog: enable all markdown extensions supported by pulldown_cmark 2020-04-12 15:36:37 +08:00
Peter Cai de8eace92e
render: use static Handlebars instance 2020-04-12 15:10:46 +08:00
Peter Cai 1f2fee8341
implement RSS feed
as an alternative common template for home page
2020-04-12 14:28:26 +08:00
Peter Cai 84ff757700
Cargo.toml: flip real optimizations on
Since I don't expect to pull in any more significant dependency, and we
are far from running out of the 1MB compressed limitation of code size,
we should be perfectly fine flipping this on instead of sticking with
optimizing for size
2020-04-12 10:46:05 +08:00
Peter Cai 90ef03daaa
theme: remove text-shadow on mobile
performance is terrible on some mobile browsers
2020-04-12 08:28:12 +08:00
Peter Cai f143deb7da
theme: kill fixed background
the performance is poor on mobile
2020-04-12 08:24:35 +08:00
Peter Cai 9077e10876
theme: support defining target=_blank in theme_config
add "target": "_blank" to the JSON
2020-04-11 21:01:23 +08:00
Peter Cai f45bd92258
theme: polish modal dialog 2020-04-11 20:57:46 +08:00
Peter Cai 38ba17019a
theme: format style 2020-04-11 20:46:04 +08:00
Peter Cai 87b332ccd2
theme: add modal to view large image 2020-04-11 20:45:07 +08:00
Peter Cai 2f2611f498
theme: style: make position sticky work correctly
Parents cannot have `overflow: hidden`.

Also removed position absolute for the wrapper and instead rely on
inline-block for horizontal center
2020-04-11 20:27:09 +08:00
Peter Cai 1c6fa0ec7d
theme: fix img width
the width of image should take padding into account
2020-04-11 20:10:27 +08:00
Peter Cai 4cd4f72e25
theme: style: make .content and .post-list look the same 2020-04-11 19:57:44 +08:00
Peter Cai f55cdf9897
theme: add mobile support 2020-04-11 19:50:51 +08:00
Peter Cai f714591b25
implement manual summary marker 2020-04-11 19:15:34 +08:00
Peter Cai 48dd6cbabc
theme: style: unify styling of headings 2020-04-11 19:04:13 +08:00
Peter Cai 9b018b559d
implement automatic anchor generation for headings 2020-04-11 19:01:30 +08:00
Peter Cai f36bfb7afa
Cargo.toml: define default build target 2020-04-11 10:11:58 +08:00
Peter Cai 23d899dd0e
support build-time theme selection via 2020-04-11 09:52:45 +08:00
Peter Cai 292b204262
theme: hide overflow-x 2020-04-11 09:22:26 +08:00
Peter Cai d8f05bad95
render: remove dummy argument in handlebars helper
turns out they just can't handle `||` -- adding a space in between fixes
the problem.
2020-04-11 09:18:02 +08:00
Peter Cai e8fdba132b
theme: style scrollbar 2020-04-11 09:15:53 +08:00
Peter Cai 269d2ad9a9
theme: show progress bar before navigating to another page 2020-04-11 09:12:01 +08:00
Peter Cai caa6775d65
theme: add loading progressbar
do not show page until at least the stylesheet is loaded
2020-04-10 21:27:05 +08:00
Peter Cai bbcb48beeb
implement post page rendering 2020-04-10 21:10:30 +08:00
Peter Cai 1110a2614b
render: implement pagination 2020-04-10 20:57:53 +08:00
Peter Cai e599007ed4
use build datetime as version string on static resources 2020-04-10 20:42:55 +08:00
Peter Cai 150940cd8c
add template and implement rendering 2020-04-10 20:38:53 +08:00
Peter Cai b2d6678405
sanitize proxied remote content response
re-construct the Response object to make sure no strange headers slip
into our own response.
2020-04-09 20:11:48 +08:00
Peter Cai d8edb51d6a
add explanation why we need a custom binding 2020-04-09 19:18:48 +08:00
Peter Cai 4474769004
proxy remote media inserted in posts
To protect user privacy and speed up page loading
2020-04-09 19:15:45 +08:00
Peter Cai 1b42c65294
blog: add more comment on PostContentCache 2020-04-09 17:18:52 +08:00
Peter Cai 2bd9b169f3
blog: add more comment on cache version 2020-04-09 17:16:04 +08:00
Peter Cai 8ba086a9ec
implement Markdown rendering 2020-04-09 14:47:46 +08:00
Peter Cai 02d64f4a18
check Cargo.lock into project
this is an end-user project even if the Rust part is built as a WASM
2020-04-09 12:41:34 +08:00
Peter Cai c91d152d65
project restruct: use webpack instead of wrangler's wasm-pack support
The generated script from wrangler keeps re-instantiating the WASM
module every time the request is processed. Instead, let's switch to
using the much, much better Webpack support for WASM.
2020-04-09 12:40:15 +08:00
Peter Cai e562a8d7e4
worker.js: do not run wasm_bindgen multiple times
seems like this thing can fail occassionally. just don't run bindgen
all the time.
2020-04-08 21:29:20 +08:00
Peter Cai fe22944cb4
add some no-cache headers 2020-04-08 21:12:58 +08:00
Peter Cai cd8f761fcf
implement showing blog
no rendering yet
2020-04-08 20:00:40 +08:00
Peter Cai aa95d978ec
add alias support for `unlisted` 2020-04-08 18:11:35 +08:00
Peter Cai 7de1212993
also remove post from list if unlist is set 2020-04-08 18:10:13 +08:00
Peter Cai c68263a7bd
add comments to note on unlisted notes 2020-04-08 17:58:33 +08:00
Peter Cai b337306799
utils: also kill punctuations when generating URLs 2020-04-08 17:56:36 +08:00
Peter Cai b87c97c8ed
support unlisted posts 2020-04-08 17:56:27 +08:00
Peter Cai 8fe31281f0
support customized metadata 2020-04-08 17:39:44 +08:00
Peter Cai 4995de8372
implement publishing / updating 2020-04-08 16:51:39 +08:00
Peter Cai b910f25cc7
store: do not panic when kv reads null
instead, return an empty string.
2020-04-07 21:31:10 +08:00
Peter Cai 09081dd1d7
use macro to generate headers 2020-04-07 21:24:09 +08:00
Peter Cai 243a64b7b9
implement basic KV binding 2020-04-07 20:54:04 +08:00