previewer-eclipse-plugin

September 18, 2026 · View on GitHub

Build Status Contributor Covenant License Eclipse Marketplace

Feedback and high-quality pull requests are highly welcome!

  1. What is it?
  2. Installation
  3. Adding support for other formats
  4. Building from Sources
  5. Acknowledgement
  6. License

What is it?

This extensible EclipseⓇ plugin contributes a new Preview view that displays rendered versions of files opened in text editors.

This plugin is best used together with the TM4E incl. Language Pack and Extra Syntax Highlighting Plugin which provide syntax highlighting for the supported source files.

The following formats are supported out of the box:

  • CSV and TSV files
  • Draw.io diagrams
  • GitHub flavored Markdown (GFM), including:
    • Syntax highlighting for explicitly labelled fenced code blocks when using the local CommonMark renderer
    • Mermaid fenced blocks: mermaid
    • Pikchr fenced blocks: pikchr
      The optional center, float-left, float-right, and indent layout modifiers are supported after the language name.
    • PlantUML fenced blocks: plantuml, puml, iuml, pu
    • Graphviz DOT fenced blocks: dot, graphviz
      Embedded DOT blocks use the Graphviz renderer selected in the Eclipse preferences: bundled viz.js or an external dot executable.
    • TeX/LaTeX math in GitHub's inline, display, and fenced math forms
      Math is rendered locally with the bundled MathJax when Eclipse uses a modern browser backend.
      On Windows, select Microsoft Edge WebView2 in the Preview preference page; the legacy Internet Explorer browser backend cannot run MathJax and displays the TeX source instead.
  • Graphviz DOT diagrams
  • HTML
  • JSON, JSONC and JSON5 files with a filterable native tree preview (JSON5 support is best effort)
  • Mermaid diagrams
  • Pikchr diagrams
    Pikchr is rendered locally with the bundled WebAssembly runtime when Eclipse uses a modern browser backend.
    On Windows, select Microsoft Edge WebView2 in the Preview preference page; the legacy Internet Explorer browser backend cannot run the bundled runtime.
  • PlantUML diagrams
  • Scalable Vector Graphics (SVG)
  • Terrastruct D2 diagrams (requires d2 executable from https://github.com/terrastruct/d2/releases installed locally)
  • TextMate grammars (requires the Eclipse TM4E plugin)

When a file supports multiple previews, use Preview as in the Preview view or Preview Editor to choose one. For example, a TextMate .tmLanguage.json file can be shown as TextMate Grammar or JSON Tree. The choice is remembered per file while that view or editor remains open; Automatic restores the default selection.

JSON preview

The JSON preview shows a read-only tree in both the Preview view and the Preview Editor. The preview offers filtering by key or value, colors for different value types, and actions to copy values, subtrees, or JSON Pointers. Double-click a key or value to select it in the source editor. Navigation is not available when previewing a compare editor.

Fonts and colors can be customized under General > Appearance > Colors and Fonts > Previewer > JSON.

Comments, trailing commas, hexadecimal numbers and common JSON5 syntax are accepted in .json, .jsonc and .json5 files. JSON5 support is best effort; some syntax is unsupported or interpreted differently. Continued strings retain their line breaks in the preview and copied values. Copied subtrees preserve numeric spelling and can contain extended JSON syntax.

Markdown rendering

By default, Markdown previews are rendered locally with CommonMark for privacy: their source is not sent to the GitHub API. To use another mode, select the Markdown Renderer on the Preview > Markdown preference page:

  • CommonMark (= offline rendering) - the default; renders Markdown locally without using the GitHub API.
  • GitHub Markdown API (= online rendering) - uses the configured GitHub API for every Markdown preview.
    An API token is not required for public content, but it is recommended for either GitHub mode because authenticated requests have a much higher REST API rate limit. Configure it using API Token on the same preference page.
    The Use CommonMark renderer when offline or GitHub Markdown API is unavailable preference makes either GitHub mode fall back to CommonMark when the API is unavailable. This fallback is enabled by default.
  • Automatic (= GitHub API for non-ignored files in GitHub repositories) - uses the GitHub API only for existing, non-ignored files in repositories with a github.com remote, and CommonMark for all other files.
    Automatic mode also falls back to CommonMark when JGit is unavailable or the repository status cannot be determined.
    Note that Git treats indexed files as non-ignored, even when a later ignore rule matches them.

Examples

Markdown

Graphviz

JSON

TextMate Grammar

Installation

To install the plugin into an existing Eclipse installation do:

  1. Within Eclipse go to: Help -> Install New Software...
  2. Enter the following update site URL: https://raw.githubusercontent.com/sebthom/previewer-eclipse-plugin/updatesite
  3. Select the Previewer feature to install.
  4. Ensure that the option Contact all update sites during install to find required software is enabled.
  5. Click Next twice.
  6. Read/accept the license terms and click Finish.
  7. Eclipse will now download the necessary files in the background.
  8. When the download has finished, Eclipse will ask about installing unsigned content. You need to accept if you want to
  9. After installation you will be prompted for a restart of Eclipse, which is recommended.

Adding support for other formats

The plugin provides extension points that allow registration of additional renderers to support more file formats. If you are new to Eclipse plugin development please consult https://github.com/eclipse-platform/eclipse.platform/blob/master/docs/FAQ/FAQ_What_are_extensions_and_extension_points.md for more details about extension points.

  1. The htmlPreviewerRenderer extension point allows to register classes implementing de.sebthom.eclipse.previewer.api.HtmlPreviewRenderer: HtmlPreviewRenderer are used to render source files to a HTML representation. The renderer plugin display the generated HTML inside managed browser component.

    <extension point="de.sebthom.eclipse.previewer.renderers">
       <htmlPreviewRenderer class="com.example.ConfigHtmlPreviewRenderer" file-extensions="cfg,ini" file-pattern="**/.cfg/_config_rc" file-names="CONFIG_RC" />
    </extension>
    
  2. The previewerRenderer extension point allows to register classes implementing de.sebthom.eclipse.previewer.api.PreviewRenderer: If rendering to HTML is not desirable or possible PreviewRenderers can be used to render source files onto an SWT Composite managed by the renderer itself.

    <extension point="de.sebthom.eclipse.previewer.renderers">
       <previewRenderer class="com.example.ConfigPreviewRenderer" file-extensions="cfg,ini" file-pattern="**/.cfg/_config_rc" file-names="CONFIG_RC" />
    </extension>
    

For tree-based formats, extend AbstractTreePreviewRenderer. It provides filtering, tree actions, refresh handling, state restoration and source navigation. Subclasses supply their own parsed model, JFace providers, entry IDs, source ranges and presentation; see JsonPreviewRenderer for an example.

Set a previewRenderer's name attribute to its display name in the Preview as chooser. For a general-purpose previewRenderer, set fallback="true" to try it after specialized contributions in Automatic mode. The default is false. Registry order is preserved within each group.

Building from Sources

To ensure reproducible builds this Maven project inherits from the vegardit-maven-parent project which declares fixed versions and sensible default settings for all official Maven plug-ins.

The project also uses the maven-toolchains-plugin which decouples the JDK that is used to execute Maven and it's plug-ins from the target JDK that is used for compilation and/or unit testing. This ensures full binary compatibility of the compiled artifacts with the runtime library of the required target JDK.

To build the project follow these steps:

  1. Download and install a Java 17 SDK, e.g. from:

  2. Download and install the latest Maven distribution.

  3. In your user home directory create the file .m2/toolchains.xml with the following content:

    <?xml version="1.0" encoding="UTF8"?>
    <toolchains>
       <toolchain>
          <type>jdk</type>
          <provides>
             <version>17</version>
             <vendor>default</vendor>
          </provides>
          <configuration>
             <jdkHome>[PATH_TO_YOUR_JDK_17]</jdkHome>
          </configuration>
       </toolchain>
    </toolchains>
    

    Set the [PATH_TO_YOUR_JDK_17] parameter accordingly.

  4. Checkout the code using one of the following methods:

    • git clone https://github.com/sebthom/previewer-eclipse-plugin
    • svn co https://github.com/sebthom/previewer-eclipse-plugin previewer-eclipse-plugin
  5. Run mvn clean verify in the project root directory. This will execute compilation, unit-testing, integration-testing and packaging of all artifacts.

Acknowledgement

Draw.io diagrams are rendered using https://www.draw.io/js/viewer.min.js, which is licensed under Apache License 2.0 .

By default, Graphviz DOT files are rendered using a bundled version of Viz.js, which is licensed under MIT.

JSON previews use Jackson Core, which is licensed under Apache License 2.0.

By default, Markdown files are rendered using a bundled version of CommonMark Java, which is licensed under BSD-2-Clause.

Rendered Markdown files are styled using GitHub MarkDown CSS, which is licensed under MIT.

Fenced code blocks in rendered Markdown files are highlighted using Highlight.js, which is licensed under the BSD 3-Clause license.

TeX math in rendered Markdown files uses a bundled version of MathJax, which is licensed under Apache License 2.0.

Mermaid files are rendered using a bundled version of Mermaid JS, which is licensed under MIT.

Pikchr files and fenced blocks are rendered using bundled versions of Pikchr and Pikchr.js, which are licensed under the Zero-Clause BSD license.

PlantUML files are rendered using a bundled version of PlantUML, which is licensed under MIT

License

If not otherwise specified (see below), files in this repository fall under the Eclipse Public License 2.0.

Individual files contain the following tag instead of the full license text:

SPDX-License-Identifier: EPL-2.0

This enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.

An exception is made for:

  1. files in readable text which contain their own license information, or
  2. files in a directory containing a separate LICENSE.txt file, or
  3. files where an accompanying file exists in the same directory with a .LICENSE.txt suffix added to the base-name of the original file. For example foobar.js is may be accompanied by a foobar.LICENSE.txt license file.