From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Rendering markdown and security vulnerabilities with injected HTML

Rendering markdown and security vulnerabilities with injected HTML

All right, so let's render the actual content of the markdown. And we need a library for that to handle the React HTML. So we're going to go back into our terminal, and we're going to download npm install remark, which is a good library for rendering markdown. And we want specifically remark HTML. And we also want remark-html as well. So we're going to use both and install. And once this has completed its installation, we want to restart the development server because we're adding libraries here. It's going to change the packaging. So we're going to rerun the build, npm run dev. And now what we're going to do is go into our code base. And we're going to go to our library posts. And we want to update this get post data. Where is it? getPostData here, so that it also is going to not just give us this matter result content, but it actually processed that content. And we're going to make this an async function, because we actually need to wait for Remark to fetch all this data…

Contents