diff --git a/react-frontend/README.md b/react-frontend/README.md index 3314312..eb162bd 100644 --- a/react-frontend/README.md +++ b/react-frontend/README.md @@ -76,6 +76,43 @@ Into ``` +> Links => Normal markdown notations + +- The normal syntax `[Text](Link)` will be rendered as a text with an icon bext to it +- The syntax `[[Text]](Link)` will be rendered as a lnik button with the text inside it + +```markdown + +[Google](https://google.com) + +--- + +[[Google]](https://google.com) + +``` + +Into + +```html + +

+

+

Google

+

+ +

+
+

+ +

+

+ + Google +
+

+ +``` + > Using Markdown Notations: Highlight Text - Use the syntax `**Text Here**` to make the text bold and with the base color diff --git a/react-frontend/src/components/HTMLMarkdown/AncherLinkMarkdown.tsx b/react-frontend/src/components/HTMLMarkdown/AncherLinkMarkdown.tsx new file mode 100644 index 0000000..c5cb261 --- /dev/null +++ b/react-frontend/src/components/HTMLMarkdown/AncherLinkMarkdown.tsx @@ -0,0 +1,35 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import Button from '../Button'; +import Header from '../MainSection/Header'; +import type { Element } from 'hast' +import { faLink } from '@fortawesome/free-solid-svg-icons'; + +type AncherLinkMarkdownProps = { + node?: Element, +} & React.HTMLAttributes; + +const AncherLinkMarkdown = ({ node, ...props }: AncherLinkMarkdownProps) => { + console.log("Title: ", props.children); + console.log("Link: ", node?.properties?.href); + const title = props.children as string; + const link = node?.properties?.href as string; + const matchButtonLink = /\[(.*)\]/.exec(title); + if (matchButtonLink) { + return ( +