mdview, a markdown viewer
mdview, a markdown viewer
From the page:
mdview is a super light-weight, GTK-based markdown files viewer. It has no other dependencies other than GTK itself. It reads and displays text files in (a subset of) markdown format, and provide live links to other files as well as to the Internet. It is ideal for showing help files (its original purpose), user manuals, and other small set of hyperlinked markdown files.
Subset of markdown that mdview supports:
* Heading level 1,2,3
* Horizontal rules
* Single-level bullets (but no ordered list)
* Inline-code and codeblocks
* Hyperlinks (format is a simplified version of original markdown)
* Inline images
* Inline formatting: italic, bold, smart double/single quotes, em-dash.
Compiles down to only 60K. No further dependency other than GTK.
Get it from here: https://chiselapp.com/user/jamesbond/re ... view3/home
-----
EDIT: Markdown files are plain text files with some human-readable formatting added. Markdown files are created and editable using standard text editor. mdview only supports a limited subset; the formatting that it supports is given in example/index.md.
-----
EDIT: mdview now can converts markdowns to plain text, decorated plain text (with vt100 bold/underline codes), and html too.
mdview is a super light-weight, GTK-based markdown files viewer. It has no other dependencies other than GTK itself. It reads and displays text files in (a subset of) markdown format, and provide live links to other files as well as to the Internet. It is ideal for showing help files (its original purpose), user manuals, and other small set of hyperlinked markdown files.
Subset of markdown that mdview supports:
* Heading level 1,2,3
* Horizontal rules
* Single-level bullets (but no ordered list)
* Inline-code and codeblocks
* Hyperlinks (format is a simplified version of original markdown)
* Inline images
* Inline formatting: italic, bold, smart double/single quotes, em-dash.
Compiles down to only 60K. No further dependency other than GTK.
Get it from here: https://chiselapp.com/user/jamesbond/re ... view3/home
-----
EDIT: Markdown files are plain text files with some human-readable formatting added. Markdown files are created and editable using standard text editor. mdview only supports a limited subset; the formatting that it supports is given in example/index.md.
-----
EDIT: mdview now can converts markdowns to plain text, decorated plain text (with vt100 bold/underline codes), and html too.
Last edited by jamesbond on Tue 19 May 2015, 15:37, edited 2 times in total.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
Works well with github markdown
A few typos in the help on the cli.
(ha, not the only one with typos .. read my screeny!)
A few typos in the help on the cli.
Code: Select all
# ./mdview -h
mdview - (C) Leandro Pereira 2009, James B 2015.
Usage: mdview [directory [file [home [title]]]]
- directory where the files arem if not specified, current directory.
- file to open, if not specified, index.md is used.
- home file. f not specified, index.md is used.
- title - window title, if not specifieid, mdview is used
You can skip parameters by specifying blanks.
# ./mdview /mnt/sda6/git-repos/pmcputemp-builds/pmcputemp-0.63 home README.md
- Attachments
-
- md.jpg
- (53.56 KiB) Downloaded 1144 times
Puppy Linux Blog - contact me for access
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
### is not h3 but link to png
working `inline code` would be nice.
working `inline code` would be nice.
- Attachments
-
- index.md.gz
- save as...
/usr/share/doc/index.md - (5.4 KiB) Downloaded 538 times
-
- fd.png
- Glued with PeasyGlue
- (108.54 KiB) Downloaded 1094 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Fatdog's Home
re-uploaded index.md
download to /usr/share/doc/index.md
launch by:
... there will be a title too.
download to /usr/share/doc/index.md
launch by:
Code: Select all
mdview /usr/share/doc "" "" "Fatdog's Home"
How about a run action?
text_x-markdown (replace the current symlink in fatdog)
In older pups with older shared-mime-info it is reported wrongly as application_x-genesis-rom .. see https://bugs.freedesktop.org/show_bug.cgi?id=27441
Code: Select all
#!/bin/sh
DIR=${@%/*}
FILE=${@##*/}
HOME=$FILE
TITLE=${FILE%.*}
mdview $DIR $FILE "$HOME" "$TITLE"
In older pups with older shared-mime-info it is reported wrongly as application_x-genesis-rom .. see https://bugs.freedesktop.org/show_bug.cgi?id=27441
Puppy Linux Blog - contact me for access
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
mdview, a markdown viewer
Looks like there is just one link allowed in a "paragraph".
This is working:
This is working:
Code: Select all
Over the time, Fatdog migrated to support 64-bit platform (hence Fatdog64 name) and grew became an independent distribution of its own - while striving to keep the original spirit of Puppy Linux of being small, fast, and versatile. For a fuller history [http://distro.ibiblio.org/fatdog/web/history.html click here].
Fatdog64 700 series - the latest iteration of Fatdog64 - is
hand-built based on recipes from [http://linuxfromscratch.org Linux From Scratch], version 7.5 (the latest when the Fatdog64 700 alpha1, the first
public release of Fatdog64 700, was released).
Thanks guys for the feedback, you keep me busy
- ah, the typo
- executable code is not in markdown spec, so I prefer not to extend it. Or, perhaps, I can add a command line switch to enable this extra feature.
- The ### bug is confirmed. This is because the original code does not support links, Leandro use some hack to enable it (I think by marking text with underlines), so everything that has underlines is taken as links.
- line can only have one link bug is also confirmed.
- ah, the typo
- executable code is not in markdown spec, so I prefer not to extend it. Or, perhaps, I can add a command line switch to enable this extra feature.
- The ### bug is confirmed. This is because the original code does not support links, Leandro use some hack to enable it (I think by marking text with underlines), so everything that has underlines is taken as links.
- line can only have one link bug is also confirmed.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
L18L's suggestion now implemented. Use $(xxx) to do it, and you need to specify "-x" on the command line. The code is very simplistic, nested $() is not supported e.g. $(echo $(echo a)) will *surely* fail.
I also added non-standard strikethrough, using --- (3 dashes). So 3-dashes now have mutliple functions. Just make sure that these dashes does not begin a line, otherwise it will be taken as either a ruler, or as a marker for header #2.
I also added non-standard strikethrough, using --- (3 dashes). So 3-dashes now have mutliple functions. Just make sure that these dashes does not begin a line, otherwise it will be taken as either a ruler, or as a marker for header #2.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
mdview, a markdown viewer
Thanks jamesbond, you keep me busy.jamesbond wrote:L18L's suggestion now implemented. Use $(xxx) to do it, and you need to specify "-x" on the command line. The code is very simplistic, nested $() is not supported e.g. $(echo $(echo a)) will *surely* fail.
Tested:
Code: Select all
![Fatdog](faqs/fatdog.png)
# Fatdog 64-bit GNU/Linux Operating System
$(TEXTDOMAIN=fatdog; gettext Cancel)
$(gettext fatdog Quit)
$(gettext 'Cancel and Quit')
Last one not. We need ' inside $().
Re-produce it by:
Code: Select all
LANGUAGE=de mdview -x /usr/share/doc home.md "" "Fatdog's Home"
- Attachments
-
- single_word_is_OK.png
- (19.61 KiB) Downloaded 960 times
Re: mdview, a markdown viewer
And I will make you even busier. Fossil updatedL18L wrote:Thanks jamesbond, you keep me busy.
This now works:
Code: Select all
$(echo '$LANG') is $(echo $LANG)
$(echo '$LANG' is $LANG)
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: mdview, a markdown viewer ready for global use
Cannot use ( ) in text.
Replaced it by --....--
Sorry if have killed an apostrophe without real need.
$(gettext 'here apostrophe can't be used')
$(gettext 'here apostrophe can\'t be used')
$(gettext "here apostrophe can be used")
review text please.
Replaced it by --....--
Sorry if have killed an apostrophe without real need.
$(gettext 'here apostrophe can't be used')
$(gettext 'here apostrophe can\'t be used')
$(gettext "here apostrophe can be used")
review text please.
Code: Select all
mdview -x /usr/share/doc home.md "" "Fatdog's Home"
- Attachments
-
- heim.png
- (36.9 KiB) Downloaded 911 times
-
- home.md.gz
- /usr/share/doc/home.md
- (5.94 KiB) Downloaded 527 times
Re: mdview, a markdown viewer ready for global use
Ah yes, because the ")" will end the $( prematurely. As I said the code is simple and stupid. Let me see if I can make it smarter. I'll be back.L18L wrote:Cannot use ( ) in text.
Replaced it by --....--
In this case, you will need to doSorry if have killed an apostrophe without real need.
$(gettext 'here apostrophe can't be used')
$(gettext 'here apostrophe can\'t be used')
$(gettext "here apostrophe can be used")
review text please.
$(gettext 'here apostrophe can '\''be used')
That is, you end the single-quote, add a \', and then start the single-quote again. Tthe same way how you single-quote strings in shell, too.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: mdview, a markdown viewer ready for global use
No sleep tonight?jamesbond wrote:I'll be back.
Re: mdview, a markdown viewer ready for global use
Try it. Attached test cases in examples.L18L wrote:No sleep tonight?
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: mdview, a markdown viewer ready for global use
Tried.jamesbond wrote:Try it.
All right.
Going to convert entire FAQ to mdview.....
Help can be launched by:
Code: Select all
export TEXTDOMAIN=fatdoghelp; mdview -x /usr/share/doc/faqs ../home.md "" "Fatdog"
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: mdview, a markdown viewer ready for global use
Fatdog64's docs/faq are going to use this markdown format,
extension .md, to be viewed with mdview.
In order to enable SURE translations we are using GNU gettext.
gettext has 2 parameters:
1st is textdomain, (name of the .mo file)
2nd is the translatable message string (msgstr).
If it is one paramter only
then environment variable TEXTDOMAIN is being used.
Example:
Space is cheap but there is no reason for wasting bytes.
usually used with C sources would be nice
but does not work because _ is a markdown tag
and alias cannot be used in mdview AFAIK.
But this little wrapper /usr/bin/t_ does work:
... and above line is just:
___________________________________
How much saved?
About = 23 kB.
Not that much but it is looking much nicer.
___________________________________
Speed?
Or an implementation of alias (alias t_=gettext) in mdview?
___________________________________
poor man's solution?
Or maybe just renaming the textdomain?
___________________________________
Or both?
___________________________________
Your choice.
___________________________________
extension .md, to be viewed with mdview.
In order to enable SURE translations we are using GNU gettext.
gettext has 2 parameters:
1st is textdomain, (name of the .mo file)
2nd is the translatable message string (msgstr).
If it is one paramter only
then environment variable TEXTDOMAIN is being used.
Example:
Code: Select all
$(gettext fatdoghelp "The VLC media player in Fatdog64 can support BluRay playback.")
Code: Select all
alias _=gettext
but does not work because _ is a markdown tag
and alias cannot be used in mdview AFAIK.
But this little wrapper /usr/bin/t_ does work:
Code: Select all
#!/bin/sh
gettext fatdoghelp "$1"; echo
Code: Select all
$(t_ "The VLC media player in Fatdog64 can support BluRay playback.")
How much saved?
About
Code: Select all
$((16 * `grep msgid fatdoghelp.pot | wc -l` / 1024))
Not that much but it is looking much nicer.
___________________________________
Speed?
Or an implementation of alias (alias t_=gettext) in mdview?
Code: Select all
$(t_ fatdoghelp"The VLC media player in Fatdog64 can support BluRay playback.")
poor man's solution?
Or maybe just renaming the textdomain?
Code: Select all
$(gettext fh "The VLC media player in Fatdog64 can support BluRay playback.")
Or both?
Code: Select all
$(t_ fh "The VLC media player in Fatdog64 can support BluRay playback.")
Your choice.
___________________________________
https://github.com/visionmedia/mad
Guys, have you considered compatibility with mad?
Guys, have you considered compatibility with mad?
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Hi, guys.
This viewer looks absolutely splendid, except for the obvious:
Maybe I'm missing a nut and a bolt (which is entirely likely!), but:
what editor do you use to create the marked text to be viewed?
Thanks in advance.
musher0
This viewer looks absolutely splendid, except for the obvious:
Maybe I'm missing a nut and a bolt (which is entirely likely!), but:
what editor do you use to create the marked text to be viewed?
Thanks in advance.
musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)