Compare commits
2 Commits
0112d23229
...
2e9520a4f1
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e9520a4f1 | |||
| 4de65c1fe5 |
@ -1,5 +1,7 @@
|
|||||||
## Elm
|
## Elm
|
||||||
|
|
||||||
|
These are my notes on the functional programming language Elm.
|
||||||
|
|
||||||
* [Formatting](./formatting)
|
* [Formatting](./formatting)
|
||||||
* [Maybe.andThen](./maybeandthen)
|
* [Maybe.andThen](./maybeandthen)
|
||||||
* [Maybe.map](./maybemap)
|
* [Maybe.map](./maybemap)
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
### Elm
|
### Elm
|
||||||
|
|
||||||
|
Dit zijn mijn notities van de functionele programmeertaal Haskell.
|
||||||
|
|
||||||
* [Formatting](./formatting)
|
* [Formatting](./formatting)
|
||||||
* [Maybe.andThen](./maybeandthen)
|
* [Maybe.andThen](./maybeandthen)
|
||||||
* [Maybe.map](./maybemap)
|
* [Maybe.map](./maybemap)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
### Haskell
|
### Haskell
|
||||||
|
|
||||||
I am learing functional programming and Haskell, these are my notes on the language.
|
These are my notes on the functional programming language Haskell.
|
||||||
|
|
||||||
* [Curried Functions](./curried-functions)
|
* [Curried Functions](./curried-functions)
|
||||||
@ -1,5 +1,5 @@
|
|||||||
### Haskell
|
### Haskell
|
||||||
|
|
||||||
I ben functioneel programmeren en Haskell aan het leren, dit zijn mijn notities van deze taal.
|
Dit zijn mijn notities van de functionele programmeertaal Haskell.
|
||||||
|
|
||||||
* [Curried Functions](./curried-functions)
|
* [Curried Functions](./curried-functions)
|
||||||
@ -4,6 +4,7 @@ import SyntaxHighlighter from 'react-syntax-highlighter';
|
|||||||
// https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/HEAD/AVAILABLE_STYLES_HLJS.MD
|
// https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/HEAD/AVAILABLE_STYLES_HLJS.MD
|
||||||
import { docco, dracula } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
import { docco, dracula } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
||||||
import { useTheme } from '../ThemeContext';
|
import { useTheme } from '../ThemeContext';
|
||||||
|
import { getLanguage } from '../Language/Language';
|
||||||
|
|
||||||
const MySection = ({ children }) => {
|
const MySection = ({ children }) => {
|
||||||
return (<section>{children}</section>);
|
return (<section>{children}</section>);
|
||||||
@ -98,6 +99,9 @@ const MyTable = ({ children }) => {
|
|||||||
|
|
||||||
const MarkdownPage = ({ md }) => {
|
const MarkdownPage = ({ md }) => {
|
||||||
const [markdownContent, setPost] = useState('');
|
const [markdownContent, setPost] = useState('');
|
||||||
|
const [pageNotFound, setPageNotFound] = useState(false);
|
||||||
|
const [errorPageContent, setErrorPage] = useState('');
|
||||||
|
const language = getLanguage();
|
||||||
|
|
||||||
// causes 3 calls somehow...
|
// causes 3 calls somehow...
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -108,46 +112,67 @@ const MarkdownPage = ({ md }) => {
|
|||||||
.then(res => setPost(res))
|
.then(res => setPost(res))
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
setPageNotFound(true);
|
||||||
|
|
||||||
|
import(`./Other/${language}/page-not-found.md`)
|
||||||
|
.then(res => {
|
||||||
|
fetch(res.default)
|
||||||
|
.then(res => res.text())
|
||||||
|
.then(res => setErrorPage(res))
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
})
|
||||||
|
.catch(err => console.log(err));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
if (pageNotFound) {
|
||||||
<Markdown
|
return (
|
||||||
options={{
|
<Markdown>
|
||||||
wrapper: MySection,
|
{errorPageContent}
|
||||||
overrides: {
|
</Markdown>
|
||||||
h1: {
|
);
|
||||||
component: MyParagraph,
|
}
|
||||||
props: {
|
else {
|
||||||
className: 'text-primary',
|
return (
|
||||||
|
<Markdown
|
||||||
|
options={{
|
||||||
|
wrapper: MySection,
|
||||||
|
overrides: {
|
||||||
|
h1: {
|
||||||
|
component: MyParagraph,
|
||||||
|
props: {
|
||||||
|
className: 'text-primary',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
h4: {
|
||||||
|
component: Myh4
|
||||||
|
},
|
||||||
|
h5: {
|
||||||
|
component: Myh5
|
||||||
|
},
|
||||||
|
img: {
|
||||||
|
component: MyImage
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
component: MyCodeBlock
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
component: MyTable
|
||||||
|
},
|
||||||
|
Jps: {
|
||||||
|
component: Jps
|
||||||
|
},
|
||||||
|
Furigana: {
|
||||||
|
component: Furigana
|
||||||
|
}
|
||||||
},
|
},
|
||||||
h4: {
|
}}>
|
||||||
component: Myh4
|
{markdownContent}
|
||||||
},
|
</Markdown>
|
||||||
h5: {
|
)
|
||||||
component: Myh5
|
}
|
||||||
},
|
|
||||||
img: {
|
|
||||||
component: MyImage
|
|
||||||
},
|
|
||||||
code: {
|
|
||||||
component: MyCodeBlock
|
|
||||||
},
|
|
||||||
table: {
|
|
||||||
component: MyTable
|
|
||||||
},
|
|
||||||
Jps: {
|
|
||||||
component: Jps
|
|
||||||
},
|
|
||||||
Furigana: {
|
|
||||||
component: Furigana
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}}>
|
|
||||||
{markdownContent}
|
|
||||||
</Markdown>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MarkdownPage;
|
export default MarkdownPage;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user