Coder Social home page Coder Social logo

darkdragon-001 / gedit-markdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nielsmde/gedit-markdown

4.0 4.0 1.0 3.6 MB

Markdown preview for gedit

License: GNU General Public License v3.0

Makefile 3.15% Shell 22.92% Python 73.29% HTML 0.64%

gedit-markdown's Introduction

Gedit Markdown Preview v3

Note: This version requires gedit 3.28 and WebKit2 (gir1.2-webkit2-4.0).

Old versions:

Overview

gedit-markdown adds support for Markdown preview in gedit, the default Gnome text editor.

Specifically, it adds:

  • Markdown snippets

  • plugin Markdown Preview for gedit, displayed in the side panel or the bottom panel and previewing in HTML the current document or selection

  • an external tool for exporting to HTML or PDF the current document or selection

screenshot1

Requirements

  • gedit-markdown v3 supports gedit 3.28. It's shipped with an installer for GNU/Linux.

  • The plugin Markdown Preview depends on the package python3-markdown and gir1.2-webkit2-4.0.

  • Recommended: PyMdown Extensions

Installation (or update)

  • Open a terminal

  • Run the following commands in the terminal:

      git clone https://github.com/darkdragon-001/gedit-markdown.git
      cd gedit-markdown
      ./gedit-markdown.sh install
    

Markdown support will be added for the current user (so no need root privileges). The folder created can be deleted after installation.

Uninstallation

  • Open a terminal in the project folder.

  • Run the uninstaller in the terminal:

      ./gedit-markdown.sh uninstall
    

Usage

First of all, restart gedit if it's already running.

Plugin Markdown Preview

To enable this plugin, go to Edit > Preferences > Plugins and check Markdown Preview.

Two items are added in the gedit menu Tools:

  • Update Markdown Preview: displays in the side panel or in the bottom panel a preview in HTML of the current document or selection.

    Note: there are two other ways to update preview:

    - with the keyboard shortcut *Ctrl+Alt+m* (can be changed in the configuration file);
    
    - by right clicking on the preview area (side or bottom panel) and selecting the item *Update Preview*.
    
  • Toggle Markdown Preview visibility: allows to display or hide the Markdown Preview panel tab.

    Note: the keyboard shortcut Ctrl+Alt+v (can be changed in the configuration file) can be used to do the same.

When right clicking on the preview area, a context menu appears and lists several options. Besides the default ones (previous page, next page, copy, etc.), we have:

  • Update Preview: reloads in the side panel or in the bottom panel the preview in HTML of the current document or selection.

Local files will be followed in the preview area while global ones will be opened with your default web browser.

Here's a screenshot of the plugin when it's displayed in the bottom panel:

screenshot

Now the same plugin displayed in the side panel (click to see the original image):

screenshot

Note that when the cursor passes over a link in the preview area, a tooltip displays the URL:

screenshot

Table of contents

When the Markdown extension toc is enabled (see Configuration file, default), add [TOC] to your Markdown source to generate a table of contents with clickable links.

Snippets

To use Markdown snippets, activate the plugin Snippets in Edit > Preferences > Plugins. Then, go to Tools > Manage Snippets... to see the possibilities.

Converters (external tools)

The following tools are included:

  • Export to HTML
  • Export to PDF

To use the external tool, activate the plugin External Tools in Edit > Preferences > Plugins. Then, go to Tools > External Tools > Export to HTML to access the tool. The keyboard shortcut Ctrl+Alt+h does the same. The code of the currently opened Markdown file or the selection will be converted in HTML/PDF, and the result will be put in a new document.

To edit the tool, go to Tools > Manage External Tools....

Configuration file

The configuration file of gedit-markdown is located at:

$XDG_CONFIG_HOME/gedit/gedit-markdown.ini

Most of the time, it will correspond to:

$HOME/.config/gedit/gedit-markdown.ini

The section markdown-preview contains several properties:

  • panel: emplacement of the preview. Possibles values: bottom (default value) or side.

  • shortcut: shortcut to refresh the preview. The default value is <Control><Alt>m.

  • extensions: a whitespace separated list of Markdown extensions. See link for possible values. Defaults to "extra toc".

  • visibility: visibility of the Markdown Preview panel tab when gedit starts. Possible values: 0 (hidden) or 1 (displayed; default value).

  • visibilityShortcut: shortcut to toggle Markdown Preview visibility. The default value is <Control><Alt>v.

  • autoIdle: only update markdown after this idle time (in milliseconds). Possible values: 0 (update immediately), 250 (default), any positive float.

  • autoReloadActivate: automatically reload the preview when the plugin is activated. Possible values: 0 (disabled) or 1 (enabled; default value).

  • autoReloadOpen: automatically reload the preview when the document is opened. Possible values: 0 (disabled) or 1 (enabled; default value).

  • autoReloadSave: automatically reload the preview when the document is saved. Possible values: 0 (disabled) or 1 (enabled; default value).

  • autoReloadTabs: automatically reload the preview when the active tab is changed. Possible values: 0 (disabled) or 1 (enabled; default value).

  • autoReloadEdit: automatically reload the preview when the text is changed. Possible values: 0 (disabled) or 1 (enabled; default value).

  • autoReloadSelection: automatically reload the preview when the selection is changed. Possible values: 0 (disabled; default value) or 1 (enabled).

Non-existent properties (as well as the whole file) will be generated with default values on startup.

Examples

Localization

The plugin Markdown Preview is localizable. The file containing strings is plugins/markdown-preview/locale/markdown-preview.pot.

Third-party code

The plugin Markdown Preview shipped with gedit-markdown is a modification of the plugin of the same name written by Jean-Philippe Fleury, under the GPL v3 or any later version.

gedit-markdown's People

Contributors

andrewsomething avatar asbjorn avatar darkdragon-001 avatar ekuester avatar jpfleury avatar nielsmde avatar smidm avatar trongthanh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

smidm

gedit-markdown's Issues

gedit aborts with core dump when trying to use markdown

@darkdragon-001
I am using gedit 3.28.1 in ubuntu 18.04 all seems to work okay until I try to use markdown feature Toggle Markdown Preview visibility. At this point the gedit crashes with an abort core dump. I am not able to view any logs so that is the limited information that I have..

information about software I have installed
Ubuntu 18.04
gedit 3.28.1
gir1.2-webkit-4.0
python3-markdown

I didn't not install the recommended PyMdown Extensions because I am not interested in installing pip.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.