Skip to content

⚡ JavaFX utility to preview Markdown in a separate window using Flexmark — perfect for developers building modern Java applications with live .md rendering support.

License

Notifications You must be signed in to change notification settings

raghul-tech/JavaFX-Markdown-Preview

Repository files navigation

JavaFX Markdown Preview Banner

JavaFX Markdown Preview

⚡ Fast. 🖼️ Beautiful. 🎯 Real-Time. 🌓 Theme-Aware.

Maven Central GitHub Release Maven Build Status CodeQL Status Javadoc (1.0.3) Buy Me A Coffee


☕ About JavaFX Markdown Preview

JavaFX Markdown Preview is a modern and lightweight library designed to render Markdown content seamlessly in JavaFX applications.

Whether you’re building a Markdown editor, a documentation viewer, or just need a clean way to preview .md content inside your app — this tool saves you hours of work by offering a plug-and-play experience.

Why use this?

Embed anywhere – Tabs, windows, or any JavaFX layout
Live preview – Automatic updates when files change
Syntax highlighting – Beautiful, GitHub-style code blocks
Copy buttons – One-click copy of code snippets
Dark and light themes – Easy toggling
Markdown to HTML export – Generate styled HTML
Cross-platform – Windows, macOS, Linux
No browser dependency – Uses JavaFX WebView

Whether you're developing documentation tools, note-taking apps, IDE plugins, or just need a Markdown viewer, this tool offers a ready-made and customizable solution.


✨ What's New in 1.0.3

Note: Version 1.0.2 contained all the new features below but failed deployment to Maven Central. Version 1.0.3 is the first properly signed and published release. Please upgrade to 1.0.3.

  • 🎯 Tab and TabPane Support
    • Embed previews inside TabPane with lifecycle management.
  • 🧩 Standalone WebView Component
    • Use a WebView node in any JavaFX layout (VBox, HBox, BorderPane).
  • 🌈 Enhanced GitHub-Style Themes
    • Cleaner dark and light themes matching GitHub styling.
  • 📝 Syntax Highlighting & Copy Buttons
    • Beautiful code blocks with one-click copy support.
  • Improved Real-Time Updates
    • Live reload when files change, with reduced flicker.
  • 💡 JavaFX 17 Compatibility
    • Runs smoothly on JavaFX 11–17.

Why use 1.0.3?

This version ensures a verified signature, successful publication to Maven Central, and fully reproducible builds.


📦 Available Modules

Artifact Name Includes Flexmark Use Case
javafx-markdown-preview ❌ No For Maven users with their own Flexmark setup
javafx-markdown-preview-all ✅ Yes Works out of the box, no extra setup

✨ Features

  • 📂 Load .md file or raw Markdown string
  • 🔄 Real-time preview with file change detection
  • 🖥️ Opens in a separate JavaFX window
  • 🔁 Reopen preview window if closed
  • 🧩 Embed in any JavaFX scene or layout
  • ☕ Supports both Java and JavaFX projects
  • ⚡ Lightweight and reusable as a utility

📦 Install via Maven

🛠️ Option 1: All-in-One (Flexmark + Code)

Add the dependency in your pom.xml:

<dependency>

  <groupId>io.github.raghul-tech</groupId>
  
  <artifactId>javafx-markdown-preview-all</artifactId>
  
  <version>1.0.3</version>
  
</dependency>

Or browse it on Maven Central.

🪶 Option 2: Minimal (bring your own Flexmark)

<dependency>
  <groupId>io.github.raghul-tech</groupId>
  <artifactId>javafx-markdown-preview</artifactId>
  <version>1.0.3</version>
</dependency>

<dependency>
  <groupId>com.vladsch.flexmark</groupId>
  <artifactId>flexmark-all</artifactId>
  <version>0.64.8</version>
</dependency>

Or browse it on Maven Central.


🏗️ Example Projects

  • You’ll find ready-to-run examples in the examples/ directory:

    • ExampleWindow.java – Launches the preview in a standalone JavaFX window, ideal for external Markdown viewers or editor popouts.

    • ExampleTabPane.java – Embeds the preview as a tab inside a TabPane, great for multi-tab document editors.

    • ExampleWebview.java – Shows how to embed the preview WebView into any JavaFX layout, such as VBox, BorderPane, or StackPane.

    • ExampleRenderer.java – Demonstrates using the MarkdownRenderer utility to convert Markdown content into styled HTML, useful for exporting or rendering elsewhere.

✅ To run an example:

  1. Download or clone this repository.

  2. Navigate to examples/ folder.

  3. Compile and run the desired file.

✅ Tip: Each example is standalone—feel free to adapt and copy the patterns directly into your project.


💡 Run Using JAR

Compile:

javac -cp java-markdown-preview-all-1.0.3.jar Markdown.java

Run:

Windows:

java -cp .;java-markdown-preview-all-1.0.3.jar Markdown

Linux/macOS:

java -cp .:java-markdown-preview-all-1.0.3.jar Markdown

🔍 Documentation


🧩 Requirements

  • OpenJFX libraries if using Java 11+

  • JavaFX (use OpenJFX for Java 11+)

  • Maven for dependency management


🆕 Changelog:


🤝 Contributing

  • We welcome contributions of all kinds:

    • 🛠️ Bug fixes

    • 🌟 Feature suggestions

    • 📚 Documentation improvements

    • 🧪 More usage examples

Please check the Contributing Guide before starting.


🐞 Report a Bug

  • If you've encountered a bug, please report it by clicking the link below. This will guide you through the bug-reporting process: ➡️ Click here to report a bug

📄 License


📬 Contact

Email: [email protected]


☕ Support

If you find this project useful, consider buying me a coffee!

Buy Me A Coffee

About

⚡ JavaFX utility to preview Markdown in a separate window using Flexmark — perfect for developers building modern Java applications with live .md rendering support.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages