8000 GitHub - rsrini7/Mermaid-Html
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rsrini7/Mermaid-Html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Mermaid Diagram Generator & Editor

This is a feature-rich, single-page web application built with HTML, CSS, and Vanilla JavaScript that leverages the power of Mermaid.js to create, view, edit, and export various types of diagrams directly in your browser.

(Optional: Add a screenshot of the application here)

Features

This tool provides a comprehensive set of functionalities for working with Mermaid diagrams:

  1. Live Mermaid Rendering:

    • Renders Mermaid syntax entered into the input area into a visual diagram.
    • Updates the preview automatically when templates are selected or when saving from the editor popup.
    • Manual rendering via the "Render Diagram" button.
  2. Wide Range of Templates:

    • Includes a dropdown menu with pre-defined templates for various diagram types:
      • Flowcharts (Top-Down, Left-to-Right, Complex with Subgraphs)
      • Sequence Diagrams (Basic, Advanced)
      • Class Diagrams
      • State Diagrams
      • Entity Relationship (ER) Diagrams
      • User Journey Maps
      • Gantt Charts
      • Pie Charts
      • Requirement Diagrams
      • Git Graphs
      • C4 Context Diagrams
      • Mind Maps
      • Timeline Diagrams
      • Quadrant Charts
    • Selecting a template populates the input area and triggers rendering.
  3. Syntax Input & Editing:

    • Main Textarea: Direct input and modification of Mermaid syntax in the left-hand panel.
    • Popup Editor: A dedicated, larger modal window (Open Editor button) for focused editing of the Mermaid syntax, reducing distractions. Includes "Save & Close" and "Close" options.
  4. Diagram Preview & Interaction:

    • Right-Side Preview: The rendered diagram is displayed in the right-hand panel for immediate visual feedback.
    • Zoom & Pan Window: (Zoom/Pan button) Opens the current diagram in a separate modal window designed for closer inspection.
      • Zoom: Use the slider to zoom in and out of the diagram. The current zoom level (%) is displayed.
      • Reset Zoom: Quickly reset the zoom level to the default.
      • Panning: Use the browser's scrollbars within the preview area to pan across the diagram when zoomed in.
  5. Export Options:

    • Export SVG: Download the rendered diagram as a scalable vector graphics (.svg) file.
    • Export PNG: Download the rendered diagram as a raster (.png) image.
      • Configurable Dimensions: Set the desired Width and Height for the exported PNG.
      • Configurable Scale: Apply a scaling factor (e.g., 2x for higher resolution) to the PNG export, based on the specified or natural dimensions.
  6. Copy to Clipboard:

    • Copy SVG: Copies the raw SVG code of the rendered diagram to the clipboard.
    • Copy PNG: Copies the rendered diagram as a PNG image directly to the clipboard (requires a secure context like HTTPS or localhost and browser support for the Clipboard API with images).
  7. Theming:

    • Light/Dark Mode: A toggle switch allows users to switch between light and dark themes.
    • Persistence: The selected theme is saved in the browser's localStorage and applied automatically on future visits.
    • Mermaid Theme Adaptation: The rendered Mermaid diagrams automatically adapt their appearance to match the selected light or dark theme.
  8. User Experience & Feedback:

    • Responsive Design: The layout adapts for usability on different screen sizes, stacking panels vertically on smaller devices.
    • Loading Indicator: Displays a "Rendering..." message while Mermaid is processing the diagram.
    • Error Handling: Shows clear error messages if the Mermaid syntax is invalid or rendering fails.
    • Copy Feedback: Buttons provide visual feedback ("Copied!") when content is successfully copied to the clipboard.
    • Smooth Animations: Subtle animations enhance the user interface for actions like opening popups, rendering diagrams, and switching themes.

How to Use

  1. Download: Obtain the working5.html file.
  2. Get Mermaid.js: Download the mermaid.min.js library file from the official Mermaid.js source (e.g., CDN or GitHub releases).
  3. Placement: Place the mermaid.min.js file in the same directory as working5.html, or update the <script src="mermaid.min.js"></script> tag in the HTML <head> to point to the correct path.
  4. Open: Open the working5.html file in a modern web browser (like Chrome, Firefox, Edge, Safari).
  5. Create:
    • Select a template from the dropdown.
    • Or, type/paste your Mermaid syntax directly into the left textarea.
    • Or, use the "Open Editor" button for a focused editing view.
  6. Render: Click "Render Diagram" (or it renders automatically after template selection/editor save).
  7. Interact & Export: Use the Zoom/Pan, Export, and Copy buttons as needed.

Dependencies

  • Mermaid.js: (Requires mermaid.min.js to be present). The core library used for parsing the syntax and rendering diagr 4D66 ams.

Technical Stack

  • HTML5
  • CSS3 (including CSS Variables for theming, Flexbox/Grid for layout, Animations/Transitions)
  • Vanilla JavaScript (ES6+)
  • Mermaid.js Library

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0