From 5af58240e8afe6886cce31642cd327f9e951b523 Mon Sep 17 00:00:00 2001 From: Alexander Alemayhu Date: Sun, 9 Oct 2022 08:47:23 +0200 Subject: [PATCH] feat: render code blocks in front Closes: https://github.com/2anki/web/issues/193 --- src/lib/notion/helpers/renderFront.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/notion/helpers/renderFront.tsx b/src/lib/notion/helpers/renderFront.tsx index 78c02d65d..b9bf785b1 100644 --- a/src/lib/notion/helpers/renderFront.tsx +++ b/src/lib/notion/helpers/renderFront.tsx @@ -2,6 +2,7 @@ import { GetBlockResponse } from '@notionhq/client/build/src/api-endpoints'; import { captureException } from '@sentry/node'; import BlockHandler from '../BlockHandler'; +import BlockCode from '../blocks/BlockCode'; import { BlockHeading } from '../blocks/BlockHeadings'; import FrontFlashcard from '../blocks/FrontFlashcard'; import BlockColumn from '../blocks/lists/BlockColumn'; @@ -33,6 +34,11 @@ export default async function renderFront( return ``; } break; + case 'code': + if (handler.settings.learnMode) { + return BlockCode(block, handler); + } + break; case 'toggle': // @ts-ignore const { toggle } = block;