Skip to content

Commit

Permalink
fix code blocks and menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Oct 4, 2023
1 parent 9605603 commit 7985a09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions modelina-website/scripts/build-docs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const path = require('path');
const { readdir, readFile, writeFile, mkdir, stat } = require('fs/promises');
const { copyFileSync } = require('fs');
const { readdir, readFile, writeFile, stat } = require('fs/promises');
const DOCS_ROOT_PATH = path.join(__dirname, '../../docs');
const DOCS_CONFIG_PATH = path.join(__dirname, '../config/docs.json');
const MODELINA_ROOT_PATH = path.resolve(__dirname, '../../');

/**
* Replace all the markdown and github specific stuff with something that works from the browser
*/
function prepareContent(content) {
content = content.replace('<!-- toc is generated with GitHub Actions do not remove toc markers -->', '');
content = content.replace('<!-- toc -->', '');
Expand Down
2 changes: 1 addition & 1 deletion modelina-website/src/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const theme = {
hljs: {
display: 'inline-block',
background: '#252f3f',
color: '#d6deeb'
},
'hljs-subst': {
color: '#d6deeb'
Expand Down Expand Up @@ -220,7 +221,6 @@ export default function CodeBlock({
: language
}
style={theme}
theme={"darcula"}
showLineNumbers={showLineNumbers}
startingLineNumber={startingLineNumber}
linenumbercontainerprops={{
Expand Down
8 changes: 4 additions & 4 deletions modelina-website/src/components/docs/Docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Docs extends React.Component<
this.renderMenuTree = this.renderMenuTree.bind(this);

}
renderMenuTree(value: any) {
renderMenuTree(value: any, isRoot: boolean) {
const isSelected = value.slug === `/docs/${this.props.slug}`;
if(value.type === 'dir') {
const hasRootReadme = value.content !== null;
Expand All @@ -46,8 +46,8 @@ class Docs extends React.Component<
}
return <>{headerReadme}<li>
<ul className='border-l border-gray-200 pl-4 ml-3 mt-1'>
{value.subPaths.map(this.renderMenuTree)}
<li key={'apidocs'} className={`cursor-pointer p-2`}><a href={'/apidocs'}>API Docs</a></li>
{isRoot && <li key={'apidocs'} className={`cursor-pointer p-2`}><a href={'/apidocs'}>API Docs</a></li>}
{value.subPaths.map((subPath: any) => this.renderMenuTree(subPath, false))}
</ul>
</li></>;
} else {
Expand All @@ -56,7 +56,7 @@ class Docs extends React.Component<
}
render() {
let { showMenu } = this.state;
const menuItems = this.renderMenuTree(DocsList.tree);
const menuItems = this.renderMenuTree(DocsList.tree, true);
return (
<div className="py-4 lg:py-8">
<div className="bg-white px-4 sm:px-6 lg:px-8 w-full xl:max-w-7xl xl:mx-auto">
Expand Down

0 comments on commit 7985a09

Please sign in to comment.