Commit Graph

30 Commits

Author SHA1 Message Date
Jimmy Cai
0fbbc12949 fix: check if paragraph exists before accessing it's textContent
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/490
2022-02-12 13:23:38 +00:00
Jimmy Cai
d75dbe2b6e
fix: copy code button does not work when line number is enabled (#487)
* fix: copy code button does not work when line number is enabled

* fix pre style

* Add gist shortcode to exampleSite
2022-02-06 20:32:37 +01:00
Jimmy Cai
88beecd101
fix: hyperlinked image (#485)
* fix: hyperlinked image

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/410

* feat: add support to inline images

* Remove unused code

* Remove data-alt-html
2022-02-06 19:58:10 +01:00
Zoroark
2b40a32d47
feat(article): Scrollspy for the table of contents (#425)
* Add first try at scrollspy (broken right now)

* Scrollspy actually works now

* Fix VS Code errors by setting JS version

* Recompute offsets when window size changes

* Improve list compatibility for toc active selection

Support up to 6 levels of indentation, properly support <ol>

* Remove debug string

* Add more docs in smoothAnchors

* Use a map to match ids to navigation elements
2022-01-22 10:35:08 +01:00
zhixuan
ca260db07e
fix(shortcode): conflict with gist shortcode (#455) 2022-01-19 01:12:29 +01:00
Jimmy Cai
4764a92df3
refactor(search): avoid issue with one character keyword (#447)
* refactor(search): avoid issue with one character keyword

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/184

* Remove keyword sorts

* fix typo: secion -> section

* fix(search): avoid matching html entity

* Use | operator to concatenate keywords

Idea from https://github.com/CaiJimmy/hugo-theme-stack/pull/436

* Add missing `matchCount`

* Limit preview length

* Don't add ellipsis to title

* add comment to `processMatches`

* Initialize DOMParser only once

* Remove marker function

* Deal with blank search

* Use const keyword for constant arrays
2022-01-18 23:19:30 +01:00
Jimmy Cai
626265bcfd
refactor(article): better support for svg and external images (#326) 2021-08-25 12:20:15 +02:00
Jimmy Cai
24915a912f
feat(article): copy button for highlight block (#295)
This button only shows on highlighted code blocks, because it uses the wrapper div.highlight
2021-08-08 18:15:27 +02:00
WingLim
46908815fc
chore: add toggleEl type (#256) 2021-07-06 12:25:27 +02:00
k
dda55f87e2
feat: change the page vertical scrollbar styles (#227)
* fix: take out [data-scheme="dark"] from :root

Taking out the [data-scheme="dark"] from :root allows us to fix the
precedence of CSS when the [data-scheme="dark"] is placed in the <html>
tag. This is needed in order to make the dark styles accesible from the
<html> elment, this will allow us to change the vertical scrollbar
styles following the dark and light schemes.

* change document.body.dataset.scheme to document.documentElement.dataset.scheme

When the dark mode is on or when the light mode is on, the
[data-scheme="light"] or [data-scheme="dark"], respectively, will be
placed in the <html> tag. Allowing us to access the dark and light color
schemes from the <html> to change the vertical scrollbar styles
according to the current color scheme.

* feat: change the page vertical scrollbar styles

This change will make the vertical scrollbar styles to follow the dark
and light color scheme modes. Also, this change will make the vertical
scrollbar to look consistent in both, Chromium and Firefox.

* make the scrollbar-track background-color transparent

The body has this transition: 'transition: background-color 0.3s ease
0s'. Making the scrollbar-track background-color transparent allow us to
appreciate that transition in the scrollbar-track when switching the
background-color.

* Move [data-scheme=dark] back to :root block

* fix(comment/waline): detect dark mode from html tag

* feat: apply custom scrollbar style to all elements

Co-authored-by: Jimmy Cai <jimmehcai@gmail.com>
2021-06-20 15:49:35 +02:00
Jimmy Cai
90e259f31e
fix(colorScheme): dispatch onColorSchemeChange at page load (#118) 2021-01-04 10:52:14 +01:00
Jimmy Cai
358e63e799
feat(darkmode): dark mode toggle (#82)
* feat(darkmode): initial support for dark mode toggle

* fix(darkmode): add svg icons

* feat(darkmode): dispatch onColorSchemeChange event

* add head/darkmode

* feat(darkmode); add colorScheme config

* style: remove empty line

* refactor(darkmode): simplify code

* style: add comment for darkmode config

* i18n support for dark mode toggle

* Some renaming
2020-12-23 19:03:40 +01:00
Jimmy Cai
e606dca404
refactor(article): remove color tag & add custom category color (#75)
closes: https://github.com/CaiJimmy/hugo-theme-stack/issues/71
2020-12-22 19:43:14 +01:00
Jimmy Cai
31c42bcfe7
refactor(gallery): rewrite gallery (#79)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/70
2020-12-22 19:35:37 +01:00
Jimmy Cai
54571f036b
refactor(ts): import script using new Hugo Module logic (#77)
Allows user to overwrite a specific script.

Note: The required version of Hugo might bump up.
2020-12-21 22:34:54 +01:00
Jimmy Cai
c018f4967a feat(search): i18n support 2020-11-06 11:49:30 +01:00
Jimmy Cai
f5d45458fd refactor(search): create Search class 2020-11-06 11:33:51 +01:00
Jimmy Cai
b97e86a7a7 style: remove empty line in main.ts 2020-11-06 11:33:33 +01:00
Jimmy Cai
2736fec285 refactor: create createElement.ts 2020-11-06 11:12:48 +01:00
Jimmy Cai
b027cbf5aa
Merge branch 'master' into template-search 2020-10-04 16:05:02 +02:00
Jimmy Cai
fa0f8fa365
feat(gallery): load PhotoSwipe lib from JSDelivr 2020-10-04 15:59:56 +02:00
Jimmy Cai
84a15e1604
feat(search): return results at typing 2020-10-04 15:53:27 +02:00
Jimmy Cai
6e48765d82
fix(search): HTML escape issue 2020-09-26 22:50:23 +02:00
Jimmy Cai
e5f96c8762
feat: add search template 2020-09-26 11:40:33 +02:00
Jimmy Cai
a2a49e7537
refactor(scss): remove alert style and script
It is not used in this theme
2020-09-23 13:22:03 +02:00
Jimmy Cai
98804e578d
refactor: add copyright info in CSS and JS 2020-09-09 16:28:38 +02:00
Jimmy Cai
af487e0f3f
feat(style): remove timeago.js, and improve article-time style 2020-09-03 11:47:55 +02:00
Jimmy Cai
6b1e660327 refactor(ts/color): improve code style and change name of some variables for more clarity 2020-08-29 11:43:00 +02:00
Jimmy Cai
32732d4bf1 feat: avoid regenerate color scheme when image URL is changed
Use MD5 as key to identify images, and .Slug as id
2020-08-28 12:11:02 +02:00
Jimmy Cai
c698d944e6 🎉 Initial commit 2020-08-22 13:20:08 +02:00