Skip to content

vovkkk/MarkupViewer

Repository files navigation

MarkupViewer

MarkupViewer is a simple previewer for various markup formats. The view will be refreshed when the opened file is saved, allowing you to use whatever editor you’d like and see the results immediately.

Features

  • Cross Platform (tested only on Windows though)
  • Updates when the file is changed
  • Auto scroll to changed part
  • Stylesheet support
  • View various markup formats (asterisk determines formats require Pandoc to be installed):
    • AsciiDoc
    • Creole
    • DocBook*
    • EPUB*
    • Markdown, Pandoc-flavour*, GitHub-flavour*, PHP Markdown Extra*
    • MediaWiki*
    • reStructuredText
    • LaTeX*
    • Office Open XML* (aka docx)
    • OPML*
    • OrgMode*
    • Textile
    • txt2tags*
  • Linked table of content as a menu or in sidebar (you can filter headers to find one)
  • Statistics — words, characters and lines count
    It, also, tries to count amount of the unique words in a document. However, take the results with a grain of salt — the application has no clue about grammatical cases.
  • Drag and drop any file on an existing MV window to preview the file
  • Print

Dependencies

Usage

$ python MarkupViewer.py <file>

To automatically open a file with this viewer in Windows, associate the filetype with the included .bat file.

You can apply styles by dropping your stylesheets in the stylesheets\ directory next to this script and selecting one from the Style menu.

To automatically open a file with this viewer in Ubuntu, create MarkupViewer.desktop file with following content:

[Desktop Entry]
Name=MarkupViewer
Comment=A simple previewer for various markup formats
Exec=/full/path/to/MarkupViewer/MarkupViewer.sh %f
Terminal=false
Type=Application

Replace /full/path/to with actual full path; move this file to ~/.local/share/applications and open mimeapps.list in this directory (or create if mimeapps.list does not exist), add association, e.g. for Markdown:

[Default Applications]
text/x-markdown=MarkupViewer.desktop

Make desktop and sh files executable in their properties in file explorer, or with chmod command in terminal.

Unicode support

MarkupViewer does support Unicode [and only Unicode] as much as Python2 and PyQt4 allow:

Text encoding

Since some of 3rd party software, used for conversion, support only UTF8 encoding (Pandoc, Markdown Python library, etc.) MarkupViewer assumes that file encoding is UTF8, although some software support other encodings (e.g. AsciiDoc, docutils)—MV ignores it.

Contributing

Feel free to make improvements. Fork and send me a pull request.

Building standalone app using PyInstaller

$ pyinstaller build.spec

Though, docutils and textile packages need to be copied by hand into root of resulted folder dist\MarkupViewer ..\Python27\Lib\site-packages\docutils-0.11-py2.7.egg\docutils
..\Python27\Lib\site-packages\textile-2.1.5-py2.7.egg\textile

Credit

The bundled style came from here.

Licence

© 2013 Matthew Borgerson mborgerson@gmail.com
© 2014 Vova Kolobok vovkkk@ya.ru
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


markup.ico is based on the markdown mark and dedicated to the public domain.

Font Awesome under SIL

© 2012 Dave Gandy http://fortawesome.github.com/Font-Awesome

Entypo under CC BY-SA

© 2012 Daniel Bruce http://www.entypo.com

About

A simple previewer for various markup formats.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •