31 Commits
dev ... main

Author SHA1 Message Date
0f64ca5849 archive notice 2024-01-02 18:40:17 +00:00
8bd9173847 update makefile to install python packages, apply executable perms to script after install 2023-10-15 16:07:10 +01:00
dc4560c232 update readme to include other dependecies 2023-10-15 16:03:33 +01:00
da0d9db113 downgrade pyyaml 5.4.1 -> 5.3.1 (workaround)
https://github.com/yaml/pyyaml/issues/601
2023-10-15 16:01:23 +01:00
98a6649a39 add search bar to all browsing menus 2023-02-16 17:20:17 +00:00
0ae70aa2b3 lecture_slides, lecture_notes metadata support 2023-02-09 13:41:16 +00:00
a91f5dcdfc use --short flag on git rev-parse 2023-02-06 14:42:37 +00:00
df8febd3cf put versions and commits on landing page 2023-02-06 14:39:10 +00:00
32a32b873e sort tags in articles 2023-02-06 14:04:45 +00:00
82e5c3e254 minor metadata presentation change 2023-02-06 13:49:18 +00:00
c8e8ecd76c add title to metadata section 2023-02-06 13:46:10 +00:00
45e9e9a95e update gitignore 2023-02-06 13:43:11 +00:00
48268770b7 add timer to search to reduce cpu usage 2023-02-06 13:42:45 +00:00
79f5acd020 update metadata styling 2023-02-06 13:41:23 +00:00
a10bca718b change fuse options to improve search 2023-02-06 13:02:00 +00:00
18ea2a3b04 remove table of contents 2023-02-06 13:01:13 +00:00
8cc14c8a3e disable input suggestions in search bar 2023-02-06 12:37:22 +00:00
a17b475a4b fix duplicate tags on site pages 2023-02-06 12:14:13 +00:00
03fff83930 update search key weightings 2023-02-06 11:51:27 +00:00
2a35e967f0 tag deduplication 2023-02-06 11:50:58 +00:00
8ba82c2911 hide toc on smaller width devices (for now) 2022-11-11 12:36:54 +00:00
b050b36747 show non-plaintext files 2022-11-11 12:23:21 +00:00
8e09404520 tag inheritance 2022-11-11 12:06:46 +00:00
1c4dad1b2e update readme 2022-11-10 16:46:59 +00:00
9ccf00e78a use amsmath style equation tagging with mathjax 2022-11-10 16:36:22 +00:00
59eccec7c4 update search weights 2022-05-07 19:50:35 +01:00
adc2a36fc2 only show horizontal scroll for equations which are too long 2022-05-03 19:19:36 +01:00
3368bdb999 update styles to better use styles.alv.cx 2022-04-14 19:35:15 +01:00
8f5d1a1a3b update to new colors styling location 2022-04-13 17:33:36 +01:00
b6e69f5596 prepare for new styling update 2022-04-13 17:05:38 +01:00
bbb49d7a34 dark mode 2022-04-12 17:57:28 +01:00
12 changed files with 257 additions and 74 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
env env
n n
web web
__pycache__

View File

@@ -1,13 +1,16 @@
install: install:
cp notes2web.py n2w_add_uuid.py /usr/local/bin cp n2w_add_uuid.py /usr/local/bin
pip3 install -r requirements.txt sed "s/N2W_COMMIT = \"\"/N2W_COMMIT = \"$$(git rev-parse --short HEAD)\"/" notes2web.py > /usr/local/bin/notes2web.py
pip3 install -r requirements.txt --break-system-packages
mkdir -p /opt/notes2web mkdir -p /opt/notes2web
cp -r templates /opt/notes2web cp -r templates /opt/notes2web
cp styles.css /opt/notes2web cp styles.css /opt/notes2web
cp fuse.js /opt/notes2web cp fuse.js /opt/notes2web
cp search.js /opt/notes2web cp search.js /opt/notes2web
cp indexsearch.js /opt/notes2web
cp toc_search.js /opt/notes2web cp toc_search.js /opt/notes2web
cp permalink.js /opt/notes2web cp permalink.js /opt/notes2web
chmod +x /usr/local/bin/notes2web.py
uninstall: uninstall:
rm -rf /usr/local/bin/notes2web.py /usr/local/bin/n2w_add_uuid.py /opt/notes2web rm -rf /usr/local/bin/notes2web.py /usr/local/bin/n2w_add_uuid.py /opt/notes2web

75
indexsearch.js Normal file
View File

@@ -0,0 +1,75 @@
const HEADERS = "headers"
const PATH = "path"
const TAGS = "tags"
const TITLE = "title"
const SEARCH_TIMEOUT_MS = 100
var SEARCH_TIMEOUT_ID = -1
const fuse = new Fuse(data, {
keys: [ 'title' ],
ignoreLocation: true,
threshhold: 0.4,
minMatchCharLength: 0,
})
const RESULTS_MAX = 15
const searchBar = document.getElementById('search')
const resultsDiv = document.getElementById('searchResults')
var results = []
function updateResultsWithTimeout() {
console.log("clearing timeout")
if (SEARCH_TIMEOUT_ID) SEARCH_TIMEOUT_ID = clearTimeout(SEARCH_TIMEOUT_ID)
SEARCH_TIMEOUT_ID = setTimeout(updateResults, SEARCH_TIMEOUT_MS)
}
function updateResults() {
console.log("updating results")
resultsDiv.innerHTML = ''
if (searchBar.value) results = fuse.search(searchBar.value, { limit: RESULTS_MAX }).map(r => r.item)
else results = data
results.forEach(r => {
wrapper = document.createElement('li')
wrapper.className = "article"
atag = document.createElement('a')
atag.href = r.path
ptag = document.createElement('p')
ptag.innerHTML = r.title + (r.isdirectory ? '/' : '')
atag.appendChild(ptag)
wrapper.appendChild(atag)
resultsDiv.appendChild(wrapper)
})
}
searchBar.addEventListener('keyup', e => {
console.log(e)
// if user pressed enter
if (e.keyCode === 13) {
if (e.shiftKey) {
window.open(results[0].path, '_blank')
} else {
window.location.href = results[0].path
}
return
}
updateResultsWithTimeout()
})
searchBar.addEventListener('change', updateResultsWithTimeout)
const searchParams = new URL(window.location.href).searchParams;
searchBar.value = searchParams.get('q');
updateResults();
console.log(results)
if (searchParams.has('lucky')) {
window.location.href = results[0].path;
}

View File

@@ -12,6 +12,7 @@ import shutil
import os import os
import regex as re import regex as re
import json import json
import yaml
TEXT_ARTICLE_TEMPLATE_FOOT = None TEXT_ARTICLE_TEMPLATE_FOOT = None
@@ -20,6 +21,11 @@ INDEX_TEMPLATE_FOOT = None
INDEX_TEMPLATE_HEAD = None INDEX_TEMPLATE_HEAD = None
EXTRA_INDEX_CONTENT = None EXTRA_INDEX_CONTENT = None
N2W_COMMIT = ""
def is_plaintext(filename):
return re.match(r'^text/', magic.from_file(str(filename), mime=True)) is not None
def get_files(folder): def get_files(folder):
markdown = [] markdown = []
@@ -33,7 +39,7 @@ def get_files(folder):
name = os.path.join(root, filename) name = os.path.join(root, filename)
if pathlib.Path(name).suffix == '.md': if pathlib.Path(name).suffix == '.md':
markdown.append(name) markdown.append(name)
elif re.match(r'^text/', magic.from_file(name, mime=True)): elif is_plaintext(name):
plaintext.append(name) plaintext.append(name)
other.append(name) other.append(name)
else: else:
@@ -41,6 +47,34 @@ def get_files(folder):
return markdown, plaintext, other return markdown, plaintext, other
def get_inherited_tags(file, base_folder):
tags = []
folder = pathlib.Path(file)
while folder != base_folder.parent:
print(f"get_inherited_tags {folder=}")
folder = pathlib.Path(folder).parent
folder_metadata = folder.joinpath('.n2w.yml')
if not folder_metadata.exists():
continue
with open(folder.joinpath('.n2w.yml')) as fp:
folder_properties = yaml.safe_load(fp)
tags += folder_properties.get('itags')
print(f"get_inherited_tags {tags=}")
return list(set(tags))
def git_head_sha1(working_dir):
git_response = subprocess.run(
[ 'git', f"--git-dir={working_dir.joinpath('.git')}", 'rev-parse', '--short', 'HEAD' ],
stdout=subprocess.PIPE
).stdout.decode('utf-8')
return git_response.strip()
def git_filehistory(working_dir, filename): def git_filehistory(working_dir, filename):
print(f"{pathlib.Path(filename).relative_to(working_dir)=}") print(f"{pathlib.Path(filename).relative_to(working_dir)=}")
@@ -119,6 +153,7 @@ def get_args():
parser.add_argument('-F', '--force', action="store_true", help="Generate new output html even if source file was modified before output html") parser.add_argument('-F', '--force', action="store_true", help="Generate new output html even if source file was modified before output html")
parser.add_argument('--fuse', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/fuse.js')) parser.add_argument('--fuse', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/fuse.js'))
parser.add_argument('--searchjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/search.js')) parser.add_argument('--searchjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/search.js'))
parser.add_argument('--indexsearchjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/indexsearch.js'))
parser.add_argument('--permalinkjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/permalink.js')) parser.add_argument('--permalinkjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/permalink.js'))
parser.add_argument('--tocsearchjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/toc_search.js')) parser.add_argument('--tocsearchjs', type=pathlib.Path, default=pathlib.Path('/opt/notes2web/toc_search.js'))
parser.add_argument('--toc-depth', type=int, default=6, dest='toc_depth') parser.add_argument('--toc-depth', type=int, default=6, dest='toc_depth')
@@ -178,7 +213,7 @@ def main(args):
# extract tags from frontmatter, save to tag_dict # extract tags from frontmatter, save to tag_dict
fm = frontmatter.load(filename) fm = frontmatter.load(filename)
if isinstance(fm.get('tags'), list): if isinstance(fm.get('tags'), list):
for tag in fm.get('tags'): for tag in list(set(fm.get('tags') + get_inherited_tags(filename, args.notes))):
t = { t = {
'path': str(pathlib.Path(output_filename).relative_to(args.output_dir)), 'path': str(pathlib.Path(output_filename).relative_to(args.output_dir)),
'title': fm.get('title') or pathlib.Path(filename).name 'title': fm.get('title') or pathlib.Path(filename).name
@@ -199,7 +234,7 @@ def main(args):
all_entries.append({ all_entries.append({
'path': '/' + str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])), 'path': '/' + str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])),
'title': fm.get('title') or pathlib.Path(filename).name, 'title': fm.get('title') or pathlib.Path(filename).name,
'tags': fm.get('tags'), 'tags': list(set(fm.get('tags'))),
'headers': header_lines, 'headers': header_lines,
'uuid': fm.get('uuid') 'uuid': fm.get('uuid')
}) })
@@ -210,10 +245,15 @@ def main(args):
# update file if required # update file if required
if update_required(filename, output_filename) or args.force: if update_required(filename, output_filename) or args.force:
filehistory = git_filehistory(args.notes, filename) filehistory = git_filehistory(args.notes, filename)
html = pypandoc.convert_file(filename, 'html', extra_args=[ with open(filename) as fp:
article = frontmatter.load(fp)
article['tags'] += get_inherited_tags(filename, args.notes)
article['tags'] = sorted(list(set(article['tags'])))
article['filehistory'] = filehistory
article['licenseFull'] = notes_license
html = pypandoc.convert_text(frontmatter.dumps(article), 'html', format='md', extra_args=[
f'--template={args.template}', f'--template={args.template}',
'-V', f'filehistory={filehistory}',
'-V', f'licenseFull={notes_license}',
'--mathjax', '--mathjax',
'--toc', f'--toc-depth={args.toc_depth}' '--toc', f'--toc-depth={args.toc_depth}'
]) ])
@@ -248,7 +288,7 @@ def main(args):
all_entries.append({ all_entries.append({
'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])), 'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])),
'title': title, 'title': title,
'tags': [], 'tags': [get_inherited_tags(filename, args.notes)],
'headers': [] 'headers': []
}) })
@@ -259,11 +299,12 @@ def main(args):
pathlib.Path(filename).relative_to(args.notes) pathlib.Path(filename).relative_to(args.notes)
) )
) )
title = os.path.basename(filename)
pathlib.Path(output_filename).parent.mkdir(parents=True, exist_ok=True) pathlib.Path(output_filename).parent.mkdir(parents=True, exist_ok=True)
all_entries.append({ all_entries.append({
'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])), 'path': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])),
'title': str(pathlib.Path(*pathlib.Path(output_filename).parts[1:])), 'title': title,
'tags': [], 'tags': [get_inherited_tags(filename, args.notes)],
'headers': [] 'headers': []
}) })
shutil.copyfile(filename, output_filename) shutil.copyfile(filename, output_filename)
@@ -277,14 +318,13 @@ def main(args):
html = re.sub(r'\$extra_content\$', '', html) html = re.sub(r'\$extra_content\$', '', html)
for entry in tag_dict[tag]: for entry in tag_dict[tag]:
html += f"<div class=\"article\"><a href=\"/{entry['path']}\">{entry['title']}</a></div>" entry['path'] = '/' + entry['path']
html += INDEX_TEMPLATE_FOOT html += f"<div class=\"article\"><a href=\"{entry['path']}\">{entry['title']}</a></div>"
html += re.sub('\$data\$', json.dumps(tag_dict[tag]), INDEX_TEMPLATE_FOOT)
with open(tagdir.joinpath(f'{tag}.html'), 'w+') as fp: with open(tagdir.joinpath(f'{tag}.html'), 'w+') as fp:
fp.write(html) fp.write(html)
dirs_to_index = [args.output_dir.name] + get_dirs_to_index(args.output_dir) dirs_to_index = [args.output_dir.name] + get_dirs_to_index(args.output_dir)
print(f"{dirs_to_index=}") print(f"{dirs_to_index=}")
print(f"{dirs_with_index_article=}") print(f"{dirs_with_index_article=}")
@@ -307,6 +347,7 @@ def main(args):
continue continue
fullpath = directory.joinpath(path) fullpath = directory.joinpath(path)
title = path.name
if path.suffix == '.html': if path.suffix == '.html':
with open(fullpath) as fp: with open(fullpath) as fp:
soup = bs(fp.read(), 'html.parser') soup = bs(fp.read(), 'html.parser')
@@ -317,7 +358,7 @@ def main(args):
title = pathlib.Path(path).stem title = pathlib.Path(path).stem
elif fullpath.is_dir(): elif fullpath.is_dir():
title = path title = path
else: elif is_plaintext(fullpath):
# don't add plaintext files to index, since they have a html wrapper # don't add plaintext files to index, since they have a html wrapper
continue continue
@@ -326,7 +367,7 @@ def main(args):
indexentries.append({ indexentries.append({
'title': str(title), 'title': str(title),
'path': str(path), 'path': './' + str(path),
'isdirectory': fullpath.is_dir() 'isdirectory': fullpath.is_dir()
}) })
@@ -348,7 +389,7 @@ def main(args):
'</p></a>' '</p></a>'
'</li>' '</li>'
) )
html += INDEX_TEMPLATE_FOOT html += re.sub(r'\$data\$', json.dumps(indexentries), INDEX_TEMPLATE_FOOT)
with open(directory.joinpath('index.html'), 'w+') as fp: with open(directory.joinpath('index.html'), 'w+') as fp:
fp.write(html) fp.write(html)
@@ -356,12 +397,15 @@ def main(args):
shutil.copyfile(args.stylesheet, args.output_dir.joinpath('styles.css')) shutil.copyfile(args.stylesheet, args.output_dir.joinpath('styles.css'))
shutil.copyfile(args.fuse, args.output_dir.joinpath('fuse.js')) shutil.copyfile(args.fuse, args.output_dir.joinpath('fuse.js'))
shutil.copyfile(args.searchjs, args.output_dir.joinpath('search.js')) shutil.copyfile(args.searchjs, args.output_dir.joinpath('search.js'))
shutil.copyfile(args.indexsearchjs, args.output_dir.joinpath('indexsearch.js'))
shutil.copyfile(args.tocsearchjs, args.output_dir.joinpath('toc_search.js')) shutil.copyfile(args.tocsearchjs, args.output_dir.joinpath('toc_search.js'))
shutil.copyfile(args.permalinkjs, args.output_dir.joinpath('permalink.js')) shutil.copyfile(args.permalinkjs, args.output_dir.joinpath('permalink.js'))
with open(args.output_dir.joinpath('index.html'), 'w+') as fp: with open(args.output_dir.joinpath('index.html'), 'w+') as fp:
with open(args.home_index) as fp2: with open(args.home_index) as fp2:
html = re.sub(r'\$title\$', args.output_dir.parts[0], fp2.read()) html = re.sub(r'\$title\$', args.output_dir.parts[0], fp2.read())
html = re.sub(r'\$h1title\$', args.output_dir.parts[0], html) html = re.sub(r'\$h1title\$', args.output_dir.parts[0], html)
html = re.sub(r'\$n2w_commit\$', N2W_COMMIT, html)
html = re.sub(r'\$notes_git_head_sha1\$', git_head_sha1(args.notes), html)
html = re.sub(r'\$data\$', json.dumps(all_entries), html) html = re.sub(r'\$data\$', json.dumps(all_entries), html)

View File

@@ -1,9 +1,13 @@
> notes2web is now called [gronk](https://github.com/alvierahman90/gronk) and development has moved
# notes2web # notes2web
View your notes as a static html site. Browse a live sample of it [here](https://notes.alv.cx). View your notes as a static html site. Browse a live sample of it [here](https://notes.alv.cx).
![](./screenshot.png) ![](./screenshot.png)
Tested with [pandoc v2.19.2](https://github.com/jgm/pandoc/releases/tag/2.19.2).
## Why? ## Why?
@@ -20,13 +24,7 @@ doing it for me:
## Install ## Install
0. Install [Pandoc](https://pandoc.org/index.html) and [Pip](https://github.com/pypa/pip) 0. Install [Pandoc](https://pandoc.org/index.html) and [Pip](https://github.com/pypa/pip), python3-dev, and a C compiler
On arch:
```
# pacman -S pandoc python-pip
```
1. Run `make install` as root 1. Run `make install` as root
## Things to Remember Whilst Writing Notes ## Things to Remember Whilst Writing Notes
@@ -38,6 +36,8 @@ doing it for me:
searching searching
- `title` --- The title of the article - `title` --- The title of the article
- `uuid` --- A unique identifier used for permalinks. More below. - `uuid` --- A unique identifier used for permalinks. More below.
- `lecture_slides` --- a list of paths pointing to lecture slides used while taking notes
- `lecture_notes` --- a list of paths pointing to other notes used while taking notes
- notes2web indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for - notes2web indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for
searching searching
@@ -59,6 +59,22 @@ The included `n2w_add_uuid.py` will add a UUID to a markdown file which does not
already. already.
Combine it with `find` to UUIDify all your markdown files (but make a backup first). Combine it with `find` to UUIDify all your markdown files (but make a backup first).
### Inherited Properties
Notes can inherit a some properties from their parent folder(s) by creating a `.n2w.yml` file in a
folder.
#### Tags
If you have a folder `uni` with all you university notes, you might want all the files in there to
be tagged `uni`:
`NOTES_PATH/uni/.n2w.yaml`:
```yaml
itags: [ university ]
```
## CLI Usage ## CLI Usage
``` ```

View File

@@ -6,6 +6,6 @@ oyaml==1.0
pypandoc==1.5 pypandoc==1.5
python-frontmatter==1.0.0 python-frontmatter==1.0.0
python-magic==0.4.24 python-magic==0.4.24
PyYAML==5.4.1 PyYAML==5.3.1
regex==2021.11.10 regex==2021.11.10
soupsieve==2.2.1 soupsieve==2.2.1

View File

@@ -3,37 +3,51 @@ const PATH = "path"
const TAGS = "tags" const TAGS = "tags"
const TITLE = "title" const TITLE = "title"
const SEARCH_TIMEOUT_MS = 100
var SEARCH_TIMEOUT_ID = -1
const fuse = new Fuse(data, { const fuse = new Fuse(data, {
keys: [ keys: [
{ {
name: HEADERS, name: HEADERS,
weight: 2 weight: 0.2
}, },
{ {
name: PATH, name: PATH,
weight: 0.5 weight: 0.1
}, },
{ {
name: TAGS, name: TAGS,
weight: 1.5 weight: 0.1
}, },
{ {
name: TITLE, name: TITLE,
weight: 1.5 weight: 4
} }
], ],
includeMatches: true includeMatches: true,
useExtendedSearch: true,
ignoreLocation: true,
threshhold: 0.4,
}) })
const RESULTS_MAX = 5
const searchBar = document.getElementById('search') const searchBar = document.getElementById('search')
const resultsMax = document.getElementById('resultsMax')
const resultsDiv = document.getElementById('results') const resultsDiv = document.getElementById('results')
var results = [] var results = []
function updateResultsWithTimeout() {
console.log("clearing timeout")
if (SEARCH_TIMEOUT_ID) SEARCH_TIMEOUT_ID = clearTimeout(SEARCH_TIMEOUT_ID)
SEARCH_TIMEOUT_ID = setTimeout(updateResults, SEARCH_TIMEOUT_MS)
}
function updateResults() { function updateResults() {
console.log("updating results")
resultsDiv.innerHTML = '' resultsDiv.innerHTML = ''
results = fuse.search(searchBar.value).slice(0, parseInt(resultsMax.value)) results = fuse.search(searchBar.value, { limit: RESULTS_MAX })
results.forEach(r => { results.forEach(r => {
wrapper = document.createElement('div') wrapper = document.createElement('div')
wrapper.className = "article" wrapper.className = "article"
@@ -95,12 +109,10 @@ searchBar.addEventListener('keyup', e => {
} }
return return
} }
updateResults() updateResultsWithTimeout()
}) })
searchBar.addEventListener('change', updateResults) searchBar.addEventListener('change', updateResultsWithTimeout)
resultsMax.addEventListener('keyup', updateResults)
resultsMax.addEventListener('change', updateResults)
const searchParams = new URL(window.location.href).searchParams; const searchParams = new URL(window.location.href).searchParams;
searchBar.value = searchParams.get('q'); searchBar.value = searchParams.get('q');

View File

@@ -1,6 +1,8 @@
@import url("https://styles.alv.cx/colors/gruvbox.css");
@import url("https://styles.alv.cx/base.css"); @import url("https://styles.alv.cx/base.css");
@import url("https://styles.alv.cx/modules/search.css"); @import url("https://styles.alv.cx/modules/search.css");
@import url("https://styles.alv.cx/modules/buttonlist.css"); @import url("https://styles.alv.cx/modules/buttonlist.css");
@import url("https://styles.alv.cx/modules/darkmode.css");
html { html {
scroll-behavior: smooth; scroll-behavior: smooth;
@@ -29,10 +31,10 @@ body {
} }
.matchHighlight { .matchHighlight {
background-color: #86c1b9; background-color: var(--blue);
} }
#sidebar > #header { padding-bottom: 1em; color: #656565;} #sidebar > #header { padding-bottom: 1em; color: var(--fg-lc);}
#header > * { #header > * {
margin: 0; margin: 0;
@@ -71,12 +73,12 @@ body {
#sidebar, #sidebar,
#toc li > a { #toc li > a {
color: #656565; color: var(--fg-lc);
} }
#toc li, ul#articlelist { list-style: none; } #toc li, ul#articlelist { list-style: none; }
#toc ul, ul#articlelist { margin-left: 0.75em ; padding-left: 0.75em; } #toc ul, ul#articlelist { margin-left: 0.75em ; padding-left: 0.75em; }
#toc ul, ul#articlelist { border-left: 1px solid #b3b3b3;} #toc ul, ul#articlelist { border-left: 1px solid var(--fg-lc);}
#toc > ul { padding; none; padding: 0; margin: 0; border: none;max-width: 100%;} #toc > ul { padding; none; padding: 0; margin: 0; border: none;max-width: 100%;}
li { padding: 0 !important; } li { padding: 0 !important; }
@@ -91,18 +93,21 @@ ul#articlelist > a{
} }
#toc li > a:hover, #toc li > a:hover,
ul#articlelist li a:hover { ul#articlelist li a:hover {
background: #d9d9d9; background: var(--bg-lc);
color: black; color: black;
} }
mjx-container { mjx-container {
overflow-x: scroll; overflow-x: auto;
} }
@media (max-width: 60em) { p.metadata { margin: 0 }
@media (max-width: 80em) {
/* CSS that should be displayed if width is equal to or less than 60em goes here */ /* CSS that should be displayed if width is equal to or less than 60em goes here */
#contentWrapper { flex-direction: column } #contentWrapper { flex-direction: column }
#sidebar { position: static; width: 100%; max-width: none; } #sidebar { position: static; width: 100%; max-width: none; height: auto; }
#tocWrapper { display: none }
} }

View File

@@ -4,38 +4,56 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
<link rel="stylesheet" type="text/css" href="/styles.css" /> <link rel="stylesheet" type="text/css" href="/styles.css" />
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script>
MathJax = {
tex: {
tags: 'ams'
}
}
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<title>$title$</title> <title>$title$</title>
</head> </head>
<body> <body>
<div id="contentWrapper"> <div id="contentWrapper">
<div id="sidebar"> <div id="content">
<div id="header"> <p class="smallText metadata">
<p class="smallText"> title: $title$
<a href="/permalink?uuid=$uuid$">permalink</a>
</p> </p>
<p class="smallText"> tags: [ $if(lecture_slides)$
<p class="smallText metadata"> lecture_slides: [
$for(lecture_slides)$
<a href="$lecture_slides$">$lecture_slides$</a>$sep$,
$endfor$
]</p>
$endif$
$if(lecture_notes)$
<p class="smallText metadata"> lecture_notes: [
$for(lecture_notes)$
<a href="$lecture_notes$">$lecture_notes$</a>$sep$,
$endfor$
]</p>
$endif$
<p class="smallText metadata">
uuid: $uuid$ (<a href="/permalink?uuid=$uuid$">permalink</a>)
</p>
<p class="smallText metadata"> tags: [
$for(tags)$ $for(tags)$
<a href="/.tags/$tags$.html">$tags$</a>$sep$, <a href="/.tags/$tags$.html">$tags$</a>$sep$,
$endfor$ $endfor$
]</p> ]</p>
<p class="smallText"> <p class="smallText metadata">
written by $for(author)$$author$$sep$, $endfor$ written by $for(author)$$author$$sep$, $endfor$
</p> </p>
<p class="smallText"> <p class="smallText metadata">
syntax highlighting based on <a href="https://pygments.org/">Pygments'</a> default syntax highlighting based on <a href="https://pygments.org/">Pygments'</a> default
colors colors
</p> </p>
<p class="smallText"> <p class="smallText metadata">
page generated by <a href="https://git.alv.cx/alvierahman90/notes2web">notes2web</a> page generated by <a href="https://git.alv.cx/alvierahman90/notes2web">notes2web</a>
</p> </p>
</div>
<h3>Table of Contents</h3>
<input id="search" placeholder="Search table of contents" />
<div id="toc">$toc$</div>
</div>
<div id="content">
<details id="commitLog"> <details id="commitLog">
<summary class="smallText"> <summary class="smallText">
Commit log (file history) Commit log (file history)

View File

@@ -14,14 +14,13 @@ Browse <a href="/notes">here</a> or by tag <a href="/.tags">here</a>.
</p> </p>
<div id="searchWrapper"> <div id="searchWrapper">
<input placeholder="Search" id="search" autofocus> <input autocomplete="off" placeholder="search" id="search" autofocus>
<input type="number" id="resultsMax" min="0" value="5">
</div> </div>
<p class="smallText" style="margin-top: 0; text-align: center;"> Press <kbd>Enter</kbd> to open first result or <kbd>Shift</kbd>+<kbd>Enter</kbd> to open in new tab</p> <p class="smallText" style="margin-top: 0; text-align: center;"> Press <kbd>Enter</kbd> to open first result or <kbd>Shift</kbd>+<kbd>Enter</kbd> to open in new tab</p>
<div id="results"> <div id="results">
</div> </div>
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a></p> <p class="smallText"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a> (commit $n2w_commit$) notes commit $notes_git_head_sha1$</p>
</div> </div>
<script src="/fuse.js"> </script> <script src="/fuse.js"> </script>
<script> const data = $data$ </script> <script> const data = $data$ </script>

View File

@@ -1,4 +1,7 @@
</ul> </ul>
<p style="font-size: 0.7em;"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a></p> <p style="font-size: 0.7em;"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a></p>
</div> </div>
<script src="/fuse.js"> </script>
<script> const data = $data$ </script>
<script src="/indexsearch.js"> </script>
</body> </body>

View File

@@ -10,5 +10,12 @@
<div id="content"> <div id="content">
<h1>$title$</h1> <h1>$title$</h1>
$extra_content$ $extra_content$
<ul class="buttonlist"> <div id="searchWrapper">
<input id="search" placeholder="search" autocomplete="off" autofocus>
</div>
<p class="searchSmallText" style="margin-top: 0; text-align: center">
Press (<kbd>Shift</kbd>+)<kbd>Enter</kbd> to open first result (in new tab)
</p>
<ul id="searchResults" class="buttonlist">
<li class="article"><a href=".."><p>../</p></a></li> <li class="article"><a href=".."><p>../</p></a></li>