2

I've found a plugin to preview markdown in gedit. But I am not sure if it is backdated. Is there any other better option for previewing markdown in gedit?

1
  • What is your Ubuntu version?
    – N0rbert
    Sep 24, 2019 at 19:08

1 Answer 1

1

The documentation in the https://github.com/jpfleury/gedit-markdown repository has Gedit 3.10 as the highest version.

We can try to launch it on modern Ubuntu. For example on 16.04 LTS with Gedit 3.18.

sudo apt-get install gedit python3-markdown
cd ~/Downloads
wget https://github.com/jpfleury/gedit-markdown/archive/master.zip
unzip master.zip
cd gedit-markdown-master
./gedit-markdown.sh install
gedit

then enable plugin in the Preferences → Plugins → Markdown Preview, but it will not work because of changed API. The error here is shown below:

Traceback (most recent call last):
 File "/home/user/.local/share/gedit/plugins/markdown-preview/__init__.py", line 113, in do_activate
   self.addMarkdownPreviewTab()
 File "/home/user/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in addMarkdownPreviewTab
   panel.add_item(self.scrolledWindow, "MarkdownPreview", _("Markdown Preview"), image)
AttributeError: 'Stack' object has no attribute 'add_item'

So I would recommend to use ReText as a replacement:

official screenshot of ReText

You can install it as simple sudo apt install retext. For spell check you need to install additional package with sudo apt install python3-enchant. It has two modes of operation - Live Preview and Preview.

Note: if you need to have latest version of ReText on old systems as 16.04 LTS, then you can install it from Python Packages with pip3 install ReText.


I have just hacked it to work with Pluma (fork of Gedit for MATE DE) in Ubuntu 18.04 LTS.
All you need is to install dependencies from APT and then use files from my Github repository:

sudo apt-get install pluma python-markdown gir1.2-webkit-3.0 python-configparser -y

cd ~/Downloads
wget https://github.com/N0rbert/pluma-markdown/archive/master.zip
unzip master.zip
cd pluma-markdown-master
./pluma-markdown.sh install

and it will look like:

pluma-markdown on Ubuntu 18.04 LTS (preview in bottom)

You can move preview to the side by editing ini-file:

sed -i 's/panel = bottom/panel = side/' ~/.config/pluma/pluma-markdown.ini

pluma-markdown on Ubuntu 18.04 LTS (preview in side)

Note: this solution with pluma-markdown will not work for Ubuntu 16.04 LTS (because of missed python integration for pluma). And it will not work on newer versions because of upgrade to WebKit2.

2
  • Thanks a lot. Retex is not a solution for gedit though. Sep 24, 2019 at 19:42
  • @ArafatHasan If you have Ubuntu 18.04 LTS - then you can use Pluma with fork on gedit-markdown. See last part of my answer.
    – N0rbert
    Sep 24, 2019 at 21:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .