diff --git a/src/screens/Chapter/TextToComponent.js b/src/screens/Chapter/TextToComponent.js index b52c61d9..f99fe18a 100644 --- a/src/screens/Chapter/TextToComponent.js +++ b/src/screens/Chapter/TextToComponent.js @@ -93,12 +93,12 @@ const TextToComponents = ({ theme, }) => { try { - regex = /(\[(?:\n|.)*?\]\(.*?\))/; + regex = /(\{(?:\n|.)*?\}\(.*?\))/; let parseText = text.trim().split(regex); return parseText.map((part, index) => { if (part) { - let match = part.match(/\[((?:\n|.)*?)\]\((.*?)\)/); + let match = part.match(/\{((?:\n|.)*?)\}\((.*?)\)/); if (match) { tag = match[1]; diff --git a/src/sources/helpers/htmlToText.js b/src/sources/helpers/htmlToText.js index b16162a3..4885eb5e 100644 --- a/src/sources/helpers/htmlToText.js +++ b/src/sources/helpers/htmlToText.js @@ -14,7 +14,7 @@ const htmlToText = (html, options = {}) => { *
-> [hr]() */ - .replace(/<\s*hr[^>]*>/gi, "[hr]()") + .replace(/<\s*hr[^>]*>/gi, "{hr}()") /** *
  • -> \n @@ -51,27 +51,27 @@ const htmlToText = (html, options = {}) => { .replace( /<\s*a[^>]*href=['"](http.*?)['"][^>]*>([\s\S]*?)<\/\s*a\s*>/gi, - "[Anchor: $2]($1)" + "{Anchor: $2}($1)" ) /** * Text -> _Text_ */ - .replace(/(.*?)<\/em>/gi, "[em]($1)") + .replace(/(.*?)<\/em>/gi, "{em}($1)") /** *

    Text

    -> [h1](Text) */ - .replace(/<(h[1-6])>(.*?)<\/h[1-6]>/gi, "[$1]($2)") - .replace(/(.*?)/gi, "[strong]($1)") + .replace(/<(h[1-6])>(.*?)<\/h[1-6]>/gi, "{$1}($2)") + .replace(/(.*?)/gi, "{strong}($1)") /** * -> [img](src) */ - .replace(/<\s*img[^>]*src=['"](.*?)['"][^>]*>/gi, "[img]($1)") + .replace(/<\s*img[^>]*src=['"](.*?)['"][^>]*>/gi, "{img}($1)") /** * Remove remaining tags