Skip to content

Commit

Permalink
Temporarily reset manual styles
Browse files Browse the repository at this point in the history
  • Loading branch information
tkleinke committed Feb 10, 2025
1 parent 27ab5b5 commit d7f301e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 1 addition & 6 deletions web/ui/src/idai_field/manual/MarkdownViewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#markdown-viewer h1::before {
counter-increment: h1Counter;
content: counter(h1Counter) '. ';
}


Expand All @@ -22,7 +21,6 @@

#markdown-viewer h2::before {
counter-increment: h2Counter;
content: counter(h1Counter) '.' counter(h2Counter) ' ';
}

#markdown-viewer h3 {
Expand All @@ -32,7 +30,6 @@

#markdown-viewer h3::before {
counter-increment: h3Counter;
content: counter(h1Counter) '.' counter(h2Counter) '.' counter(h3Counter) ' ';
}

#markdown-viewer h4 {
Expand All @@ -42,7 +39,6 @@

#markdown-viewer h4::before {
counter-increment: h4Counter;
content: counter(h1Counter) '.' counter(h2Counter) '.' counter(h3Counter) '.' counter(h4Counter) ' ';
}

#markdown-viewer h5 {
Expand All @@ -51,7 +47,6 @@

#markdown-viewer h5::before {
counter-increment: h5Counter;
content: counter(h1Counter) '.' counter(h2Counter) '.' counter(h3Counter) '.' counter(h4Counter) '.' counter(h5Counter) ' ';
}

#markdown-viewer h1,
Expand All @@ -62,7 +57,7 @@
margin-top: 25px;
}

#markdown-viewer h1:first-child {
#markdown-viewer h2:first-child {
margin-top: 0;
}

Expand Down
10 changes: 5 additions & 5 deletions web/ui/src/idai_field/manual/loadManual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ const loadMarkdown = (url: string): Promise<string> => {
const setHeadingIds = (markdown: string): string => {

return markdown.replace(
/(^|\n)# .*\n/g,
/(^|\n)## .*\n/g,
(text: string) => {
const heading: string = text
.replace('# ', '')
.replace('## ', '')
.replace(/\n/g, '');
const id: string = heading.replace(' ', '-').toLowerCase();
return `<h1 id="${id}">${heading}</h1>\n`;
return `<h2 id="${id}">${heading}</h2>\n`;
}
);
};


const getChapters = (markdown: string): Chapter[] => {

const matches = markdown.match(/<h1 id=".*">.*<\/h1>/g);
const matches = markdown.match(/<h2 id=".*">.*<\/h2>/g);

return matches.map(match => {
const result = /<h1 id="(.*)">(.*)<\/h1>/g.exec(match);
const result = /<h2 id="(.*)">(.*)<\/h2>/g.exec(match);
return {
id: result[1],
label: result[2]
Expand Down

0 comments on commit d7f301e

Please sign in to comment.