Skip to content

Commit

Permalink
Format answers as markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
tewson committed Apr 5, 2024
1 parent 8b818dc commit a0172ad
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 3 deletions.
7 changes: 6 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ export default defineConfig({
build: {
format: "file",
},
integrations: [tailwind()],
integrations: [
tailwind({
applyBaseStyles: false,
nesting: true,
}),
],
});
12 changes: 12 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"airtable": "^0.12.2",
"astro": "^4.0.6",
"lodash": "^4.17.21",
"marked": "^12.0.1",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"zod": "^3.22.4"
Expand Down
2 changes: 2 additions & 0 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
import "./base.css";
interface Props {
title?: string;
}
Expand Down
11 changes: 11 additions & 0 deletions src/layouts/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.markdown {
ul {
list-style: disc;
margin-top: 16px;
padding-left: 40px;
}
}
6 changes: 5 additions & 1 deletion src/pages/areas/[localAuthority]/[area].astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import lodash from "lodash";
import { marked } from "marked";
import {
airtableClient,
Expand Down Expand Up @@ -122,7 +123,10 @@ const {
{answer.candidateFullName}
</Link>
</h3>
<p>{answer.answer}</p>
<div
class="pb-4 markdown"
set:html={marked.parse(answer.answer ?? "")}
/>
</>
))}
</>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/candidates/[candidate].astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import lodash from "lodash";
import { marked } from "marked";
import {
airtableClient,
Expand Down Expand Up @@ -106,7 +107,10 @@ const {
questions.map((question) => (
<>
<QuestionText>{question.text}</QuestionText>
<p class="pb-4">{question.answer}</p>
<div
class="pb-4 markdown"
set:html={marked.parse(question.answer ?? "")}
/>
</>
))
) : (
Expand Down

0 comments on commit a0172ad

Please sign in to comment.