Skip to content

Commit

Permalink
Move quizdown from header and add configurability (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
FidelusAleksander authored Oct 30, 2023
1 parent 844c3ad commit b21f606
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
3 changes: 2 additions & 1 deletion content/practice_tests/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ weight: 10
badge: "actions_badge.png"
exam: "GitHub Actions"
domains: ["Author and maintain workflows/actions", "Automate tasks", "Manage GitHub Actions for the enterprise"]
shuffleAnswers: true
shuffleQuestions: true
---


{{< quizdown >}}
2 changes: 2 additions & 0 deletions content/practice_tests/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ hidden: true
badge: "admin_badge.png"
exam: "GitHub Admin"
domains: ["Repository Management", "Workflow Optimization", "Efficient Collaboration"]
shuffleAnswers: true
shuffleQuestions: true
---

{{< quizdown >}}
2 changes: 2 additions & 0 deletions content/practice_tests/advanced_security.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ hidden: true
badge: "advanced_security_badge.png"
exam: "GitHub Advanced Security"
domains: ["Vulnerability Identification", "Workflow Security", "Security Implementation"]
shuffleAnswers: true
shuffleQuestions: true
---

{{< quizdown >}}
22 changes: 0 additions & 22 deletions layouts/partials/custom-header.html

This file was deleted.

24 changes: 24 additions & 0 deletions layouts/shortcodes/quizdown.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<script
src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/quizdown.js">
</script>
<script
src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/extensions/quizdownKatex.js">
</script>
<script
src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/extensions/quizdownHighlight.js">
</script>
<script>
let config = {
startOnLoad: true, // detect and convert all div html elements with class quizdown
shuffleAnswers: {{ with .Page.Params.shuffleAnswers }} {{ . }} {{ else }} false {{ end }}, // shuffle answers for each question
shuffleQuestions: {{ with .Page.Params.shuffleQuestions }} {{ . }} {{ else }} false {{ end }}, // shuffle questions for each quiz
nQuestions: {{ with .Page.Params.nQuestions }} {{ . }} {{ else }} undefined {{ end }}, // display n questions at random, if shuffleQuestions is true
primaryColor: 'steelblue', // primary CSS color
secondaryColor: '#f2f2f2', // secondary CSS color
textColor: 'black', // text color of some elements
locale: null // language of the user interface (auto-detect per default)
};
quizdown.register(quizdownHighlight).register(quizdownKatex).init(config)
</script>


{{ $exam := .Page.Params.exam }}

<div class='quizdown'>
Expand Down

0 comments on commit b21f606

Please sign in to comment.