Skip to content

Commit 5ae2a29

Browse files
committed
Add simple preview
1 parent b9a008b commit 5ae2a29

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Markdown to HTML Converter
1+
# Markdown to HTML Converter/Previewer
22
[![Markdown-HTML-Converter (Built, Lint and Test)](https://github.com/DoctorLai/markdown-html-converter/actions/workflows/ci.yaml/badge.svg)](https://github.com/DoctorLai/markdown-html-converter/actions/workflows/ci.yaml)
33

4-
A simple web-based tool to convert Markdown to HTML. This app is built using React and runs in the browser. It provides an easy-to-use interface with two text areas, where you can paste your Markdown source (left) and convert it to HTML (right).
4+
A simple web-based tool to convert Markdown to HTML. This app is built using React and runs in the browser. It provides an easy-to-use interface with two text areas, where you can paste your Markdown source (left) and convert it to HTML (right). Meantime, the HTML will be previewed on the page.
55

66
![image](https://github.com/user-attachments/assets/c0afac08-cae8-48a1-b040-b2c5b6374b0f)
77

@@ -12,6 +12,7 @@ A simple web-based tool to convert Markdown to HTML. This app is built using Rea
1212
- **Tab Support**: Properly inserts spaces when pressing the "Tab" key inside text areas.
1313
- **Simple and Intuitive UI**: Easy to use with a clean interface.
1414
- **Deploy Easily**: `npm run build` and `npm run deploy`
15+
- **Previewer** The tool provides a real-time HTML previewer for the given markdown source.
1516

1617
## Live Demo
1718

src/App.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ export default function App() {
7474
<button onClick={convertToHtml}>Convert to HTML →</button>
7575
<button onClick={clearInputs}>❌ Clear</button>
7676
</div>
77+
78+
{/* Live HTML Preview */}
79+
<h2>🔍 Live Preview</h2>
80+
<div
81+
className="preview"
82+
dangerouslySetInnerHTML={{ __html: htmlOutput }}
83+
></div>
7784
</div>
7885
<footer>
7986
<p>

0 commit comments

Comments
 (0)