Skip to content

Commit

Permalink
Truncate history
Browse files Browse the repository at this point in the history
  • Loading branch information
nntrn committed Sep 24, 2024
0 parents commit 8f489df
Show file tree
Hide file tree
Showing 33 changed files with 4,167 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto

*.css linguist-detectable=false
*.html linguist-detectable=false
*.js linguist-detectable=false
51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Docs

on:
workflow_dispatch:
repository_dispatch:
types: [update_data]
push:
paths:
- "_includes/**"
- "_layouts/**"

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout
uses: actions/checkout@v4
- run: ./scripts/build-data.sh --remote
- run: |
./scripts/group.sh > ./_pages/actvity.md
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Build with Jekyll
run: bundle exec jekyll build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'jekyll'
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# what i'm reading

```sh
./scripts/build-data.sh --out _data
./scripts/build-data.sh --remote
./scripts/group.sh > _pages/activity.md
```

```sh
bundle install
bundle exec jekyll build
bundle exec jekyll serve
```

# trigger update

```
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST --data '{"event_type": "update_data"}' \
https://api.github.com/repos/nntrn/what-im-reading/dispatches
```
46 changes: 46 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
title: what i'm reading
description: Bookmarks from Apple Books
author: Annie Tran
url: https://nntrn.github.io
baseurl: /what-im-reading
repository: nntrn/what-im-reading
github_username: nntrn
favicon_ico: /assets/favicon.ico
theme_color: "#34e045"
font_family: monospace
fonts: ["monospace", "serif", "sans-serif"]

kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]

compress_html:
clippings: [div, p, ul, td, h1, h2]
endings: all
comments: ["<!--", "-->"]
startings: []
blanklines: true
profile: false

links: ["activity", "feed"]

page_gen:
- data: "genres"
template: "genre"
index_files: true
dir: "tag"
- data: "books"
template: "book"
name: "slug"
index_files: false
dir: "tags"

include:
- _pages

exclude:
- README.md
- Gemfile.lock
- .archive
- annotations.json
- scripts
- .github
16 changes: 16 additions & 0 deletions _includes/docs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
aside{border-top:dotted 2px gray;padding-top:2rem}
h2{margin:.5rem 0}
h3,h4,h5{margin-bottom:.25rem}
h3,h4,h5{margin-top:0}
h3{margin:0 0}
q:after{content:""}
q:before{content:""}
.bookmark q{white-space:pre-wrap}
.clamp{display:-webkit-box!important;-webkit-line-clamp:var(--clamp-lines,1);-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}
.gap{gap:var(--gap)}
.site-title{font-size:2rem}
.toc{max-height:min(300px,40vh);position:sticky;top:1rem;font-size:.9rem;z-index:1;width:20px;max-width:20px}
.toc a{display:block;text-decoration:none;font-weight:400;white-space:pre;padding:0 4px;line-height:1;color:#222}
.toc a:hover{text-decoration:none;background:#eee}
.toc a:hover:after{text-decoration:none;border:0;content:attr(title);position:absolute;right:1.5rem;background:#fff;padding:2px 4px;z-index:1;font-size:.8rem}
.mark q{background:var(--bs-highlight-bg)}
45 changes: 45 additions & 0 deletions _includes/minimal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
body{font-size:var(--font-size);font-family:var(--body-font);line-height:1.2}
a{color:#0063c4;text-decoration-color:currentColor}
a:hover{color:#5393da}
aside ul{display:flex;flex-direction:column;gap:.5rem;width:80%}
aside{padding:2rem 0}
body{width:100%;height:100%;overflow-x:hidden;margin:0 0;padding:0 0;font-variant:proportional-nums;word-break:break-word}
footer{padding:1rem 0}
h2{margin:.5rem 0}
h3,h4,h5{margin-bottom:.25rem}
h3,h4,h5{margin-top:0}
h3{margin:0 0}
header{padding:1rem 0;margin-bottom:.5rem;background:#fff;position:sticky;top:0}
hr{border:0;border-bottom:1px solid #aaa;box-shadow:0}
q:after{content:""}
q:before{content:""}
table .small{font-family:sans-serif}
table tr .padded{padding-bottom:var(--gap)}
.acenter{align-content:center;align-items:center}
.bookmark .meta{color:#a5a5a5;margin-top:.25rem}
.bookmark .meta a:hover+span{color:#0063c4}
.bookmark q{white-space:pre-wrap}
.chapters{width:100%}
.chapters ul[data-label]:before{font-size:1.35rem;content:attr(data-label);margin-top:1.5rem;font-family:times;font-weight:700;margin-left:-1.25rem}
.clamp{display:-webkit-box!important;-webkit-line-clamp:var(--clamp-lines,1);-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}
.col{flex-direction:column}
.column-reverse{flex-direction:column-reverse}
.flex{display:flex}
.gap{gap:var(--gap,1rem)}
.mark q{background:#ff0}
.muted{color:#9e9e9e}
.my-0{margin-top:0;margin-bottom:0}
.no-under{text-decoration:none!important}
.sb{justify-content:space-between}
.site-title{margin:0 0;font-size:1.5rem}
.small{font-size:.85rem}
.smaller{font-size:90%}
.toc{max-height:min(300px,40vh);position:sticky;top:1rem;font-size:.9rem;z-index:1;width:20px;max-width:20px}
.toc a{display:block;text-decoration:none;font-weight:400;white-space:pre;padding:0 4px;line-height:1;color:#222}
.toc a:hover{text-decoration:none;background:#eee}
.toc a:hover:after{text-decoration:none;border:0;content:attr(title);position:absolute;right:1.5rem;background:#fff;padding:2px 4px;z-index:1;font-size:.8rem}
.up{text-transform:uppercase}
.under,a,u{text-decoration-thickness:1.5px;text-decoration-skip-ink:none}
.wrap{flex-wrap:wrap}
[data-level]{padding-right:calc(var(--gap)*2);text-align:right}
[data-level="1"] h2{font-family:sans-serif;text-transform:uppercase;margin-bottom:.5rem;white-space:pre}
17 changes: 17 additions & 0 deletions _includes/postlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{%- assign pagetag = page.tags %}
{%- assign books = site.data.books | where: 'tags', pagetag |sort: 'title' %}
<aside class="my-3">
<h5>Other posts in <a class="fs-5" href="{{pagetag|relative_url}}">{{pagetag|upcase}}</a></h5>
<ul class="d-flex flex-column gap-2 my-3">
{%- for book in books %}
<li>
{%- if book.slug == page.slug -%}
<u>{{book.title}}</u>
{%- else -%}
<a title="{{book.count}} bookmark{%- if book.count > 1 -%}s{%- endif-%}" href="{{book.permalink|relative_url}}">{{book.title}}</a>
{%- endif -%}
<span class="text-muted">&nbsp;by {{book.author}}</span>
</li>
{%- endfor %}
</ul>
</aside>
25 changes: 25 additions & 0 deletions _includes/root.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
:root {
--px-size: 2.5%;
--sans-serif: Helvetica Neue, Helvetica, Arial, sans-serif;
--bull-margin: 4px;
--bull-symbol: "•";
--underline-rgb: 53, 224, 71;
--underline-color: rgb(var(--underline-rgb));
--meta-rgb: 134, 25, 143;
--body-rgb: 34, 34, 34;
--link-rgb: 51, 102, 203;
--meta-color: rgb(var(--meta-rgb));
--body-color: rgb(var(--body-rgb));
--h: 10;
--s: 73.4%;
--l: 54%;
--hsl: var(--h), var(--s), var(--l);
--darker: hsl(var(--h), 89%, 20%);
--accent-color: hsl(var(--h), var(--s), var(--l));
--gray: hsl(0, 0%, var(--l, 80%));
--heart: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M13.35 20.13c-.76.69-1.93.69-2.69-.01l-.11-.1C5.3 15.27 1.87 12.16 2 8.28c.06-1.7.93-3.33 2.34-4.29c2.64-1.8 5.9-.96 7.66 1.1c1.76-2.06 5.02-2.91 7.66-1.1c1.41.96 2.28 2.59 2.34 4.29c.14 3.88-3.3 6.99-8.55 11.76z"/></svg>');
--svg-size: 10px;
--heart: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3.25 9.75c3 3.5 4.75 4.5 4.75 4.5s1.75-1 4.75-4.5s1-7-1.5-7s-3.25 3-3.25 3s-.75-3-3.25-3s-4.5 3.5-1.5 7"/></svg>');
--star: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path fill="currentColor" d="m12 2l3.104 6.728l7.358.873l-5.44 5.03l1.444 7.268L12 18.28L5.534 21.9l1.444-7.268L1.538 9.6l7.359-.873z" opacity=".16"/><path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="m12 2l3.104 6.728l7.358.873l-5.44 5.03l1.444 7.268L12 18.28L5.534 21.9l1.444-7.268L1.538 9.6l7.359-.873z"/></g></svg>')
}

11 changes: 11 additions & 0 deletions _includes/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const $ = query => document.querySelector(query)
const $$ = query => Array.from(document.querySelectorAll(query))

{% include scripts/theme.js %}
{% include scripts/book.js %}

window.addEventListener("load", function () {
if (localStorage.getItem('theme')) {
setTheme(localStorage.getItem('theme'))
}
})
8 changes: 8 additions & 0 deletions _includes/scripts/book.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function highlightAnnotation() {
if (Number(location.hash.substr(1,))) {
Array.from(document.querySelectorAll('.mark')).forEach(e => e.classList.remove('mark'))
document.querySelector(`[id="${location.hash.slice(1,)}"]`).classList.add('mark')
}
}
highlightAnnotation()
window.onhashchange = highlightAnnotation;
13 changes: 13 additions & 0 deletions _includes/scripts/font.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function setFont(font) {
const selectEl = $(`#fontselect [name=${font}]`)
const sitefont = selectEl.value
selectEl.selected = true
$("body").style.setProperty("--body-font", sitefont)
$("html").style.fontSize = selectEl.getAttribute("size")
}

function changeBodyFont(ev) {
const fontname = $("#fontselect").selectedOptions[0].getAttribute("name")
setFont(fontname)
localStorage.setItem("font", fontname)
}
6 changes: 6 additions & 0 deletions _includes/scripts/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function setTheme(theme) {
const _theme = theme || $("select#theme").value || "monospace"
$(`select#theme [name="${_theme}"]`).selected = true
document.body.dataset.layout = _theme
localStorage.setItem("theme", _theme)
}
Loading

0 comments on commit 8f489df

Please sign in to comment.