Add Markdown Preview to the Gedit Text Editor

Add Markdown Preview To Gedit Text Editor

Gedit is one of the most popular open source text editor which comes pre-installed with any Linux based operating system, which comes with the GNOME desktop environment. And although it can be used just as a normal and simple text editor, Gedit also supports Markdown preview, but you have to install a plugin named ‘Gedit Markdown Preview’ in order to add support for this feature.

In this tutorial, we will discuss how to install Gedit on your system and also add this plugin to the application.

Also read : How to install QOwnNotes on Linux

Installing Gedit on Linux

If this application does not come pre-installed on your system, you can easily install it by typing the following commands in your Terminal:

# On Debian and Ubuntu based distributions:
sudo apt update && sudo apt install gedit

# On Fedora workstation
sudo dnf install gedit

# On Arch Linux based distributions:
sudo pacman -S gedit
Installing Gedit On Fedora
Installing Gedit On Fedora

Note that you can also install this application directly from your Application store/Software center if you do not have to type commands in the terminal.

Installing Gedit From The Software Center
Installing Gedit From The Software Center

Once installed, you can simply launch this application from your Application Grid/Menu.

Features of the Plugin

This plugin adds the following features to the already awesome Gedit text editor:

  • Alongwith letting you open .md files in your text editor, this plugin also lets you add a preview panel so that you can edit and preview your markdown in real time while you edit your documents.
  • Preview panel can be toggled on or off as per your preferences, and its position can also be set either in a sidebar on the left side or at the bottom of the window.
  • You can zoom in and out of the preview.
  • The Preview also lets you open links and images.
  • The preview also works for HTML and SVG files as well, so if you are editing those files, this plugin can also help you there.
  • You can also apply a custom stylesheet (a .css file) and use the python3-markdown extensions to add additional features and functionality.
  • It also allows you to print from the preview or export it to the HTML, PDF, TEX, DOCX, ODT, TXT, PPTX, RTF or HTML/JS formats.

Installing Markdown Preview Plugin

If you are using any Arch Linux or any of its derivative distributions such as Manjaro or Endeavor OS, then you can simply install this plugin from the Arch User Repository (AUR). Just open a terminal and type the following commands:

yay -S gedit-plugin-markdown_preview-git

Download the latest release of the plugin from GitHub page.

Download The Latest Version Of Markdown Preview Plugin
Download The Latest Version Of Markdown Preview Plugin

Now, open a Terminal window and type the following commands to extract the zip file:

mkdir plugin
cd plugin
unzip ~/Downloads/gedit-plugin-markdown_preview-2.0.zip
Extractting The Zip File
Extracting The Zip File

Note that you should use the correct version of the plugin in the above command, 2.0 is the latest version of Markdown Preview as of now, but it can change in the future.

Once the zip file is extracted, just install the plugin by typing the following commands:

cd gedit-plugin-markdown_preview-2.0/
./install.sh
Installing The Plugin
Installing The Plugin

If you have encountered any trouble while installing the plugin, you should try installing the dependencies using your package manager, which are python3-markdown, gir1.2-webkit2-4.0 and pandoc.

Also Read : Koodo – A Beautiful Open-Source E-Book Reader for Linux

Enabling the plugin

Once the plugin is installed, you have to manually enable it from Gedit settings. Just open the application and go into ‘Preferences’ menu.

Open Gedit Preferences
Open Gedit Preferences

Now, go to the ‘Plugins’ tab and look for ‘Markdown Preview’ plugin and enable the plugin.

Enable The Plugin From Gedit Settings
Enable The Plugin From Gedit Settings

The Plugin should be enabled by now in your Gedit Text editor.

Summary

Overall, this is a really awesome plugin which lets you extend the features of already awesome Gedit text editor. However, if you feel like uninstalling the plugin for some reason, you can do so by running the following script from the same extracted zip file:

./uninstall.sh
Uninstalling The Plugin Is Very Easy
Uninstalling The Plugin Is Very Easy