diff --git a/blog/2020-08-10-my-first-blog.md b/blog/2020-08-10-my-first-blog.md deleted file mode 100644 index 0268535..0000000 --- a/blog/2020-08-10-my-first-blog.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -templateKey: blog-post -title: My First Blog -date: 2020-08-10T02:11:01.556Z -image: /img/beautiful-calla-lily-nice-background-color-70725804.jpg -tags: - - JavaScript - - React ---- -**This is my bold text** - -*This is my italic text* - -```javascript -import { get } from 'lodash'; - -get(object, 'value.1'); -``` - -***[a link](https://google.com)*** - -> ***blockquote*** - -* *list 1* - - * *list 2* - -![](/img/beautiful-calla-lily-nice-background-color-70725804.jpg "Test image") diff --git a/blog/2020-08-13-extend-popular-libraries-with-es6-proxy.md b/blog/2020-08-13-extend-popular-libraries-with-es6-proxy.md index 107f10c..b08864b 100644 --- a/blog/2020-08-13-extend-popular-libraries-with-es6-proxy.md +++ b/blog/2020-08-13-extend-popular-libraries-with-es6-proxy.md @@ -10,7 +10,7 @@ Sometimes, I find myself constrained by the limited functionalities provided by Let's define a few utility functions -``` +```typescript export function wrap(wrapper: W, base: B): W & B { const proxy = new Proxy(wrapper, { get(target, property) { @@ -43,7 +43,7 @@ The \`wrap\` method takes in 2 arguments: a wrapper object and a base object. It A sample use case where I extend the IORedis library: -``` +```typescript import IORedis from 'ioredis'; import { from, interval, Observable } from 'rxjs'; import { concatMap, filter, flatMap } from 'rxjs/operators'; @@ -83,4 +83,4 @@ The \`connectRedis\` method will first attempt to create the base \`ioredis\` ob You can find the full source code in this [github](https://github.com/tuan231195/vdtn359-news/blob/develop/packages/schema/src/redis/redis.ts). -**Happy coding!** \ No newline at end of file +**Happy coding!** diff --git a/src/components/markdown/CodeBlock.tsx b/src/components/markdown/CodeBlock.tsx index 345027c..533fb2b 100644 --- a/src/components/markdown/CodeBlock.tsx +++ b/src/components/markdown/CodeBlock.tsx @@ -33,13 +33,13 @@ export const LineContent = styled.span` display: table-cell; `; -export function CodeBlock({ children, className }) { - const language = className.replace(/language-/, ''); +export function CodeBlock({ children, className = '' }) { + const language = className.replace(/language-/, '') || 'javascript'; return ( {({ className, style, tokens, getLineProps, getTokenProps }) => (