Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: render markdown in calendar event descriptions #76

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ resources/
.DS_Store
.hugo_build.lock
content/de/calendar.md
content/en/calendar.md
content/en/calendar.md
node_modules
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,57 @@

Staging: https://staging.x-hain.de [![status-badge](https://ci.x-hain.de/api/badges/xHain-hackspace/xhain-website/status.svg?branch=staging)](https://ci.x-hain.de/xHain-hackspace/xhain-website)

Production: https://www.x-hain.de [![status-badge](https://ci.x-hain.de/api/badges/xHain-hackspace/xhain-website/status.svg?branch=main)](https://ci.x-hain.de/xHain-hackspace/xhain-website)
Production: https://www.x-hain.de [![status-badge](https://ci.x-hain.de/api/badges/xHain-hackspace/xhain-website/status.svg?branch=main)](https://ci.x-hain.de/xHain-hackspace/xhain-website)

## Getting started

### Install Hugo

#### Mac OS

* Install brew (for installing the rest): ``/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"``
* Install go: ``brew install go``
* Install hugo: ``brew install hugo``
- Install brew (for installing the rest): `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
- Install go: `brew install go`
- Install hugo: `brew install hugo`

#### For Windows/Linux

* Install hugo: [Hugo Website](https://gohugo.io)
- Install hugo: [Hugo Website](https://gohugo.io)

### Pull Submodules (eg. Theme)

* Initial pull submodule xhain-theme: ``git submodule update --init --recursive``
* Submodule update: ``git submodule foreach git pull origin master``
- Initial pull submodule xhain-theme: `git submodule update --init --recursive`
- Submodule update: `git submodule foreach git pull origin master`

### Install Dependencies

We use NPM to manage dependencies. Install these by running:

`npm install`

### Generate Site

* Run hugo to generate HTML: ``hugo``
* Run hugo for local development:
- Run hugo to generate HTML: `hugo`
- Run hugo for local development:

``hugo server --config config.toml,home.toml``
`hugo server --config config.toml,home.toml`

or
or

``hugo server --config config.toml,home.toml -w --cleanDestinationDir``
`npm run dev`

## Content Editing

### New Post

* create new post (using archetypes):
- create new post (using archetypes):

``hugo new de/post/YYYY-MM-DD_title.de.md -k post``
`hugo new de/post/YYYY-MM-DD_title.de.md -k post`

or
or

``hugo new en/post/YYYY-MM-DD_title.en.md -k post``
`hugo new en/post/YYYY-MM-DD_title.en.md -k post`

* just edit new post in the "content"-folder
- just edit new post in the "content"-folder

## Calendar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting changes were made by prettier to bring the file in line with best practices

Expand Down
11 changes: 10 additions & 1 deletion assets/css/_calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
padding: 0.8rem 1rem;
border-radius: 0.3rem;
font-size: 0.9rem;
line-height: 1.5em;
margin-top: 0.5em;
word-break: break-word;
hyphens: auto;

.time {
Expand All @@ -168,6 +168,11 @@
}
}

.title {
display: block;
overflow: hidden;
}

.location {
margin: 1em 0;
width: max-content;
Expand Down Expand Up @@ -199,6 +204,10 @@

&:hover {
color: $link-color;

.title {
text-decoration: underline;
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ body {

a {
color: $secondary-color;
text-decoration: none;
text-underline-offset: 0.15em;
}

a:hover {
Expand Down Expand Up @@ -175,6 +175,11 @@ nav {
font-family: $font-family-brand;
}

header a,
nav a {
text-decoration: none;
}

main {
img,
video,
Expand Down
8 changes: 7 additions & 1 deletion assets/js/calendar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { marked } from "marked";

// global DOM elements and variables
const activeEventInterval = 1000 * 60 * 10; // 10 minutes
let $calendar = null;
Expand Down Expand Up @@ -125,7 +127,11 @@ function setupModal() {
}

function openModal(eventElement) {
const eventData = { ...eventElement.dataset };
const eventData = {
...eventElement.dataset,
// parse markdown in the description
description: marked.parse(eventElement.dataset.description),
};
$overlay.innerHTML = renderModal(modalTemplate, eventData);
showModal();
}
Expand Down
1 change: 1 addition & 0 deletions layouts/calendar/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ <h1 id="article-title">{{ .Title }}</h1>
aria-modal="true"
></div>
</main>

{{ end }}
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "xhain-website",
"version": "1.0.0",
"description": "Staging: https://staging.x-hain.de [![status-badge](https://ci.x-hain.de/api/badges/xHain-hackspace/xhain-website/status.svg?branch=staging)](https://ci.x-hain.de/xHain-hackspace/xhain-website)",
"main": "index.js",
"scripts": {
"dev": "hugo server --config config.toml,home.toml",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/xHain-hackspace/xhain-website.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/xHain-hackspace/xhain-website/issues"
},
"homepage": "https://github.com/xHain-hackspace/xhain-website#readme",
"dependencies": {
"marked": "^12.0.2"
}
}