Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 29 May 2015, 00:21
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
mdview, a markdown viewer
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [38 Posts]   Goto page: 1, 2, 3 Next
Author Message
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Tue 28 Apr 2015, 12:54    Post subject:  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/repository/mdview3/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.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread

Last edited by jamesbond on Tue 19 May 2015, 11:37; edited 2 times in total
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7942
Location: qld

PostPosted: Fri 01 May 2015, 06:13    Post subject:  

Works well with github markdown Cool


A few typos in the help on the cli.

Code:
# ./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


(ha, not the only one with typos .. read my screeny!)
md.jpg
 Description   
 Filesize   53.56 KB
 Viewed   329 Time(s)

md.jpg


_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Fri 01 May 2015, 08:05    Post subject:  

### is not h3 but link to png

working `inline code` would be nice.

Wink
index.md.gz
Description  save as...
/usr/share/doc/index.md
gz

 Download 
Filename  index.md.gz 
Filesize  5.4 KB 
Downloaded  23 Time(s) 
fd.png
 Description   Glued with PeasyGlue
 Filesize   108.54 KB
 Viewed   297 Time(s)

fd.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Fri 01 May 2015, 09:35    Post subject: Fatdog's Home  

re-uploaded index.md

download to /usr/share/doc/index.md

launch by:

Code:
mdview /usr/share/doc "" "" "Fatdog's Home"

... there will be a title too.
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7942
Location: qld

PostPosted: Fri 01 May 2015, 18:02    Post subject:  

How about a run action?

Code:
#!/bin/sh
DIR=${@%/*}
FILE=${@##*/}
HOME=$FILE
TITLE=${FILE%.*}
mdview $DIR $FILE "$HOME" "$TITLE"


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

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Sat 02 May 2015, 05:22    Post subject: mdview, a markdown viewer
Subject description: links
 

Looks like there is just one link allowed in a "paragraph".

This is working:
Code:

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).
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Sat 02 May 2015, 06:14    Post subject:  

Thanks guys for the feedback, you keep me busy Smile
- ah, the typo Sad
- 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, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Sun 03 May 2015, 05:35    Post subject:  

All done except L18L's executable code request. Fossil updated.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Sun 03 May 2015, 13:09    Post subject:  

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.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Mon 04 May 2015, 04:35    Post subject: mdview, a markdown viewer
Subject description: gettext
 

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.

Thanks jamesbond, you keep me busy.
Tested:
Code:
![Fatdog](faqs/fatdog.png)
# Fatdog 64-bit GNU/Linux Operating System

$(TEXTDOMAIN=fatdog; gettext Cancel)

$(gettext fatdog Quit)

$(gettext  'Cancel and Quit')

The first two work.
Last one not. We need ' inside $().
Re-produce it by:
Code:
LANGUAGE=de mdview -x  /usr/share/doc home.md "" "Fatdog's Home"
single_word_is_OK.png
 Description   
 Filesize   19.61 KB
 Viewed   174 Time(s)

single_word_is_OK.png

Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Mon 04 May 2015, 08:16    Post subject: Re: mdview, a markdown viewer
Subject description: gettext
 

L18L wrote:
Thanks jamesbond, you keep me busy.

And I will make you even busier. Fossil updated Twisted Evil
This now works:
Code:
$(echo '$LANG') is $(echo $LANG)

$(echo '$LANG' is $LANG)

Btw - the output of $() *will* be interpreted as markdown code. Output of $(echo **bold**) will be shown as bold. But again, please don't nest $() or get too smart with it - the code inside is simple and stupid Laughing

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Mon 04 May 2015, 14:12    Post subject: 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.

Code:
mdview -x  /usr/share/doc home.md "" "Fatdog's Home"
heim.png
 Description   
 Filesize   36.9 KB
 Viewed   131 Time(s)

heim.png

home.md.gz
Description  /usr/share/doc/home.md
gz

 Download 
Filename  home.md.gz 
Filesize  5.94 KB 
Downloaded  17 Time(s) 
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Mon 04 May 2015, 14:44    Post subject: Re: mdview, a markdown viewer ready for global use  

L18L wrote:
Cannot use ( ) in text.
Replaced it by --....--

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.

Quote:
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.

In this case, you will need to do
$(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, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2929
Location: www.eussenheim.de/

PostPosted: Mon 04 May 2015, 14:53    Post subject: Re: mdview, a markdown viewer ready for global use  

jamesbond wrote:
I'll be back.

No sleep tonight? Shocked
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2457
Location: The Blue Marble

PostPosted: Mon 04 May 2015, 15:56    Post subject: Re: mdview, a markdown viewer ready for global use  

L18L wrote:
No sleep tonight? Shocked
Twisted Evil Try it. Attached test cases in examples.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [38 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0886s ][ Queries: 12 (0.0043s) ][ GZIP on ]