From e818b628f547950744a206182e0d0ba4629b38d2 Mon Sep 17 00:00:00 2001 From: riya-2206 Date: Wed, 19 Jun 2024 13:01:43 +0530 Subject: [PATCH] have updated the component as mentioned in the PR review --- src/hooks/useParseMarkdown.js | 63 +---------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/src/hooks/useParseMarkdown.js b/src/hooks/useParseMarkdown.js index e4c5ad255..856ca0736 100644 --- a/src/hooks/useParseMarkdown.js +++ b/src/hooks/useParseMarkdown.js @@ -5,68 +5,7 @@ function useParseMarkdown() { const API_BASE_URL = siteConfig.customFields.API_BASE_URL; const API_AUTH_KEY = siteConfig.customFields.API_AUTH_KEY; - const weeklyGoals = (markdown) => { - markdown = markdown.replace(/^### (.*$)/gim, "

$1

"); - markdown = markdown.replace(/^## (.*$)/gim, `

$1

`); - markdown = markdown.replace(/^# (.*$)/gim, `

$1

`); - - markdown = markdown.replace(/\*\*(.*)\*\*/gim, "$1"); - markdown = markdown.replace(/\*(.*)\*/gim, "$1"); - - markdown = markdown.replace( - /- \[ \] (.*$)/gim, - ' $1', - ); - markdown = markdown.replace( - /- \[x\] (.*$)/gim, - ' $1', - ); - - markdown = markdown.replace(/^\s*-\s+(.*$)/gim, "
  • $1
  • "); - markdown = markdown.replace(/(
  • .*<\/li>)/gim, ""); - - markdown = markdown.replace( - /!\[(.*?)\]\((.*?)\)/gim, - "$1", - ); - - markdown = markdown.replace(/\r\n\r\n/g, ""); - markdown = markdown.replace(/(?:\r\n|\r|\n)/g, "
    "); - - return markdown.trim(); - } - const weeklyLearnings = (markdown) => { - markdown = markdown.replace(/^### (.*$)/gim, "

    $1

    "); - markdown = markdown.replace(/^## (.*$)/gim, `

    $1

    `); - markdown = markdown.replace(/^# (.*$)/gim, `

    $1

    `); - - markdown = markdown.replace(/\*\*(.*)\*\*/gim, "$1"); - markdown = markdown.replace(/\*(.*)\*/gim, "$1"); - - markdown = markdown.replace( - /- \[ \] (.*$)/gim, - ' $1', - ); - markdown = markdown.replace( - /- \[x\] (.*$)/gim, - ' $1', - ); - - markdown = markdown.replace(/^\s*-\s+(.*$)/gim, "
  • $1
  • "); - markdown = markdown.replace(/(
  • .*<\/li>)/gim, ""); - - markdown = markdown.replace( - /!\[(.*?)\]\((.*?)\)/gim, - "$1", - ); - - markdown = markdown.replace(/\r\n\r\n/g, ""); - markdown = markdown.replace(/(?:\r\n|\r|\n)/g, ""); - - return markdown.trim(); - } - - return { weeklyGoals, weeklyLearnings,API_BASE_URL,API_AUTH_KEY }; + return { API_BASE_URL,API_AUTH_KEY }; } export default useParseMarkdown; \ No newline at end of file