Skip to content

Commit

Permalink
Merge pull request #231 from AmrutaJayanti/MarkDown
Browse files Browse the repository at this point in the history
Added Markdown Previewer
  • Loading branch information
Avdhesh-Varshney authored Jun 3, 2024
2 parents 0451eeb + d79180e commit f4766fe
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Vanilla-JS-Projects/Advanced/Markdown-Previewer/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<h1 align='center'><b>💥 Markdown Previewer 💥</b></h1>

<!-- -------------------------------------------------------------------------------------------------------------- -->

<h3 align='center'>Tech Stack Used 🎮</h3>
<!-- enlist all the technologies used to create this project from them (Remove comment using 'ctrl+z' or 'command+z') -->

<div align='center'>

![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)
![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white)
![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
<!-- ![jQuery](https://img.shields.io/badge/jquery-%230769AD.svg?style=for-the-badge&logo=jquery&logoColor=white) -->
<!-- ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) -->
<!-- ![Redux](https://img.shields.io/badge/redux-%23593d88.svg?style=for-the-badge&logo=redux&logoColor=white) -->
<!-- ![TailwindCSS](https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge&logo=tailwind-css&logoColor=white) -->
<!-- ![Web3.js](https://img.shields.io/badge/web3.js-F16822?style=for-the-badge&logo=web3.js&logoColor=white) -->
<!-- ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) -->
<!-- ![Angular.js](https://img.shields.io/badge/angular.js-%23E23237.svg?style=for-the-badge&logo=angularjs&logoColor=white) -->
<!-- ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) -->
<!-- ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) -->
<!-- ![Vue.js](https://img.shields.io/badge/vuejs-%2335495e.svg?style=for-the-badge&logo=vuedotjs&logoColor=%234FC08D) -->
<!-- ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) -->
</div>


![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)

<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: Description 📃

<div>
<!-- <p>Add Description of the project</p> -->
<p>Build a web application where users can write Markdown text in a textarea, and see the rendered HTML preview live as they type</p>
</div>


<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: How to run it? 🕹️

<!-- Add steps how to run this project -->
<p>To run this project locally, follow these steps:

- Fork this repository.
- Clone the forked repository.
- Open index.html in your web browser to start your culinary exploration.

</p>


<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: Screenshots 📸
<!-- add the screenshot of the project (Mandatory) -->

![MarkdownPreviewer](https://raw.githubusercontent.com/AmrutaJayanti/WebMasterLog/MarkDown/Vanilla-JS-Projects/Advanced/Markdown-Previewer/screenshot.webp)




![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)

<!-- -------------------------------------------------------------------------------------------------------------- -->

<h4 align='center'>Developed By <b><i>Amruta Jayanti</i></b> 👦</h4>
<p align='center'>
<a href='https://www.linkedin.com/in/amruta-jayanti-064523254?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app'>
<img src='https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white' />
</a>
<a href='https://github.com/AmrutaJayanti'>
<img src='https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white' />
</a>
</p>

<h4 align='center'>Happy Coding 🧑‍💻</h4>

<h3 align="center">Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
23 changes: 23 additions & 0 deletions Vanilla-JS-Projects/Advanced/Markdown-Previewer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Markdown Previewer</title>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.3.10/purify.min.js"></script>

</head>
<body>
<div class="container">
<textarea id="markdown-input" placeholder="Enter Markdown here..."></textarea>
<div id="preview"></div>
</div>




<script src="script.js"></script>
</body>
</html>
Binary file not shown.
13 changes: 13 additions & 0 deletions Vanilla-JS-Projects/Advanced/Markdown-Previewer/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

document.addEventListener('DOMContentLoaded', function() {
const markdownInput = document.getElementById('markdown-input');
const preview = document.getElementById('preview');

function updatePreview() {
// Sanitize and render markdown
const sanitizedHtml = DOMPurify.sanitize(marked.parse(markdownInput.value));
preview.innerHTML = sanitizedHtml;
}

markdownInput.addEventListener('input', updatePreview);
});
31 changes: 31 additions & 0 deletions Vanilla-JS-Projects/Advanced/Markdown-Previewer/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}

.container {
display: flex;
justify-content: space-around;
align-items: flex-start;
margin-top: 50px;
}

textarea {
width: 45%;
height: 400px;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
}

#preview {
width: 45%;
height: 400px;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
overflow-y: auto;
}

0 comments on commit f4766fe

Please sign in to comment.