-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed the markup issue for Explore Waterloo Region events
- Loading branch information
Showing
4 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NodeHtmlMarkdown } from 'node-html-markdown' | ||
const markdown = new NodeHtmlMarkdown() | ||
import dynamic from 'next/dynamic' | ||
import {decode} from 'html-entities'; | ||
const ReactMarkdown = dynamic(() => import('react-markdown')) | ||
|
||
export default function Test() { | ||
|
||
const original = `<p>Experience the ultimate combination of gourmet delights and scenic beauty with Waterloo Central Railway\\'s “Brew & Bite” trains!</p>\\n` | ||
const decoded = decode(original) | ||
const cleaned = decoded.replace(/&#(\d+);/g, (m, d) => String.fromCharCode(d)) | ||
const uriDecoded = decodeURIComponent(cleaned) | ||
const trimmed = uriDecoded.replace(/\\n|\\/g, "") | ||
const description = markdown.translate(trimmed) | ||
|
||
return ( | ||
<> | ||
<ReactMarkdown>{description}</ReactMarkdown> | ||
</> | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters