Skip to content

Commit

Permalink
fix: add preview for .md files
Browse files Browse the repository at this point in the history
  • Loading branch information
Its-Just-Nans committed Jan 20, 2024
1 parent e2e8a4a commit ec0108b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def size(size_in_bytes):
text-decoration: none;
}
.thumbnail span img {
.thumbnail span > * {
border-width: 0;
padding: 2px;
min-width: 500px;
min-width: 800px;
}
.thumbnail:hover span {
Expand Down Expand Up @@ -99,9 +99,13 @@ def create_index_html(folder):
isdir = os.path.isdir(p)
date = datetime.fromtimestamp(getmtime(p)).strftime("%Y-%m-%d %H:%M:%S")
url = FOLDER if isdir else UNKNOWN
preview = not isdir and not name.endswith(".md")
preview = not isdir
add = 'class="thumbnail"' if preview else ""
other = f'<span><img src="{name}"></span>' if preview else ""
other = ""
if name.endswith(".md"):
other = f'<span><iframe src="{name}"></iframe></span>'
elif preview:
other = f'<span><img src="{name}"></span>'
s += t.substitute(
file=name, date=date, size=size(getsize(p)), url=url, add=add, other=other
)
Expand Down

0 comments on commit ec0108b

Please sign in to comment.