mirror of
https://github.com/mfocko/blog.git
synced 2024-11-22 13:03:47 +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();
|
require("dotenv").config();
|
||||||
|
|
||||||
function constructDocs(subject) {
|
class Subject {
|
||||||
return [
|
constructor(subject, description) {
|
||||||
"@docusaurus/plugin-content-docs",
|
this.subject = subject;
|
||||||
{
|
this.description = description;
|
||||||
id: subject,
|
}
|
||||||
path: subject,
|
|
||||||
routeBasePath: subject,
|
docs() {
|
||||||
sidebarPath: require.resolve("./sidebars.js"),
|
return [
|
||||||
editUrl: "https://gitlab.fi.muni.cz/xfocko/kb/tree/main",
|
"@docusaurus/plugin-content-docs",
|
||||||
remarkPlugins: [math],
|
{
|
||||||
rehypePlugins: [katex],
|
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} */
|
/** @type {import('@docusaurus/types').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
title: "Additional materials by mf",
|
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: [
|
stylesheets: [
|
||||||
{
|
{
|
||||||
|
@ -71,48 +97,7 @@ const config = {
|
||||||
navbar: {
|
navbar: {
|
||||||
title: "Additional materials by mf",
|
title: "Additional materials by mf",
|
||||||
items: [
|
items: [
|
||||||
{
|
...subjects.map(s => s.navbar()),
|
||||||
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++",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
href: "https://gitlab.fi.muni.cz/xfocko/fi",
|
href: "https://gitlab.fi.muni.cz/xfocko/fi",
|
||||||
label: "GitLab",
|
label: "GitLab",
|
||||||
|
|
Loading…
Reference in a new issue