mirror of
https://github.com/mfocko/blog.git
synced 2024-12-22 11:51:28 +01:00
chore: refactor config
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
bca52fdc0e
commit
b94c33faaa
1 changed files with 41 additions and 56 deletions
|
@ -9,21 +9,47 @@ const katex = require("rehype-katex");
|
|||
|
||||
require("dotenv").config();
|
||||
|
||||
function constructDocs(subject) {
|
||||
return [
|
||||
"@docusaurus/plugin-content-docs",
|
||||
{
|
||||
id: subject,
|
||||
path: subject,
|
||||
routeBasePath: subject,
|
||||
sidebarPath: require.resolve("./sidebars.js"),
|
||||
editUrl: "https://gitlab.fi.muni.cz/xfocko/kb/tree/main",
|
||||
remarkPlugins: [math],
|
||||
rehypePlugins: [katex],
|
||||
},
|
||||
];
|
||||
class Subject {
|
||||
constructor(subject, description) {
|
||||
this.subject = subject;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
docs() {
|
||||
return [
|
||||
"@docusaurus/plugin-content-docs",
|
||||
{
|
||||
id: this.subject,
|
||||
path: this.subject,
|
||||
routeBasePath: this.subject,
|
||||
sidebarPath: require.resolve("./sidebars.js"),
|
||||
editUrl: "https://gitlab.fi.muni.cz/xfocko/kb/tree/main",
|
||||
remarkPlugins: [math],
|
||||
rehypePlugins: [katex],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
navbar() {
|
||||
return {
|
||||
type: "doc",
|
||||
docId: `${this.subject}-intro`,
|
||||
docsPluginId: this.subject,
|
||||
position: "left",
|
||||
label: `${this.subject.toUpperCase()}: ${this.description}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const subjects = [
|
||||
new Subject("ib002", "Algorithms"),
|
||||
// new Subject("ib015", "Non-imperative programming"),
|
||||
// new Subject("ib110", "Introduction to informatics"),
|
||||
// new Subject("ib111", "Foundations of programming"),
|
||||
new Subject("pb071", "C"),
|
||||
new Subject("pb161", "C++"),
|
||||
];
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: "Additional materials by mf",
|
||||
|
@ -53,7 +79,7 @@ const config = {
|
|||
],
|
||||
],
|
||||
|
||||
plugins: ["ib002", "ib015", "ib110", "ib111", "pb071", "pb161"].map(constructDocs),
|
||||
plugins: subjects.map(s => s.docs()),
|
||||
|
||||
stylesheets: [
|
||||
{
|
||||
|
@ -71,48 +97,7 @@ const config = {
|
|||
navbar: {
|
||||
title: "Additional materials by mf",
|
||||
items: [
|
||||
{
|
||||
type: "doc",
|
||||
docId: "ib002-intro",
|
||||
docsPluginId: "ib002",
|
||||
position: "left",
|
||||
label: "IB002: Algorithms",
|
||||
},
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib015-intro",
|
||||
// docsPluginId: "ib015",
|
||||
// position: "left",
|
||||
// label: "IB015: Non-imperative programming",
|
||||
// },
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib110-intro",
|
||||
// docsPluginId: "ib110",
|
||||
// position: "left",
|
||||
// label: "IB110: Introduction to informatics",
|
||||
// },
|
||||
// {
|
||||
// type: "doc",
|
||||
// docId: "ib111-intro",
|
||||
// docsPluginId: "ib111",
|
||||
// position: "left",
|
||||
// label: "IB111: Foundations of programming",
|
||||
// },
|
||||
{
|
||||
type: "doc",
|
||||
docId: "pb071-intro",
|
||||
docsPluginId: "pb071",
|
||||
position: "left",
|
||||
label: "PB071: C",
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
docId: "pb161-intro",
|
||||
docsPluginId: "pb161",
|
||||
position: "left",
|
||||
label: "PB161: C++",
|
||||
},
|
||||
...subjects.map(s => s.navbar()),
|
||||
{
|
||||
href: "https://gitlab.fi.muni.cz/xfocko/fi",
|
||||
label: "GitLab",
|
||||
|
|
Loading…
Reference in a new issue