Skip to content

Commit 9fb45b3

Browse files
committed
Smaller font size for code
1 parent 8ff36d4 commit 9fb45b3

File tree

1 file changed

+44
-39
lines changed

1 file changed

+44
-39
lines changed

src/components/common/MarkdownRender.tsx

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const MarkdownRenderBlock = styled.div`
5050
pre {
5151
font-family: 'Fira Mono', source-code-pro, Menlo, Monaco, Consolas,
5252
'Courier New', monospace;
53-
font-size: 1rem;
53+
font-size: 0.875rem;
5454
padding: 1rem;
5555
border-radius: 4px;
5656
line-height: 1.5;
@@ -233,51 +233,56 @@ const MarkdownRender: React.FC<MarkdownRenderProps> = ({
233233
const throttledUpdate = React.useMemo(() => {
234234
return throttle(delay, (markdown: string) => {
235235
remark()
236-
.use(remarkParse)
237-
.use(slug)
238-
.use(prismPlugin)
239-
.use(embedPlugin)
240-
.use(remark2rehype, { allowDangerousHTML: true })
241-
.use(raw)
242-
.use(breaks)
243-
.use(math)
244-
.use(katex)
245-
.use(stringify)
246-
.process(markdown, (err: any, file: any) => {
247-
const lines = markdown.split(/\r\n|\r|\n/).length
248-
const nextDelay = Math.max(Math.min(Math.floor(lines * 0.5), 1500), 22)
249-
if (nextDelay !== delay) {
250-
setDelay(nextDelay)
251-
}
252-
const html = String(file);
236+
.use(remarkParse)
237+
.use(slug)
238+
.use(prismPlugin)
239+
.use(embedPlugin)
240+
.use(remark2rehype, { allowDangerousHTML: true })
241+
.use(raw)
242+
.use(breaks)
243+
.use(math)
244+
.use(katex)
245+
.use(stringify)
246+
.process(
247+
markdown,
248+
(err: any, file: any) => {
249+
const lines = markdown.split(/\r\n|\r|\n/).length;
250+
const nextDelay = Math.max(
251+
Math.min(Math.floor(lines * 0.5), 1500),
252+
22,
253+
);
254+
if (nextDelay !== delay) {
255+
setDelay(nextDelay);
256+
}
257+
const html = String(file);
253258

254-
if (onConvertFinish) {
255-
onConvertFinish(html);
256-
}
257-
// load twitter script if needed
258-
if (html.indexOf('class="twitter-tweet"') !== -1) {
259-
// if (window && (window as any).twttr) return;
260-
loadScript('https://platform.twitter.com/widgets.js');
261-
}
259+
if (onConvertFinish) {
260+
onConvertFinish(html);
261+
}
262+
// load twitter script if needed
263+
if (html.indexOf('class="twitter-tweet"') !== -1) {
264+
// if (window && (window as any).twttr) return;
265+
loadScript('https://platform.twitter.com/widgets.js');
266+
}
262267

263-
if (!editing) {
264-
setHtml(filter(html));
265-
return;
266-
}
268+
if (!editing) {
269+
setHtml(filter(html));
270+
return;
271+
}
267272

268-
try {
269-
const el = parse(html);
270-
setHasTagError(false);
271-
setElement(el);
272-
} catch (e) {}
273-
}, 1)
273+
try {
274+
const el = parse(html);
275+
setHasTagError(false);
276+
setElement(el);
277+
} catch (e) {}
278+
},
279+
1,
280+
);
274281
});
275282
}, [delay, editing, onConvertFinish]);
276283

277-
278-
279284
useEffect(() => {
280-
throttledUpdate(markdown)
285+
throttledUpdate(markdown);
281286
}, [markdown, throttledUpdate]);
282287

283288
return (

0 commit comments

Comments
 (0)