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 Thu 27 Jun 2019, 06:34
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Browsers and Internet
Markdown to HTML
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Author Message
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Mon 22 Apr 2019, 04:13    Post subject:  Markdown to HTML
Subject description: command line program(s): markdown, mkd2html, makepage and md2html GUI app
 

Hi All,
==============================================================
EDIT 2019-04-27, see for a GUI program to convert markdown to html, here:
http://murga-linux.com/puppy/viewtopic.php?p=1026422#1026422
EDIT: portable version of md2html-gui, has choice for different styles, 64 and 32 bit, here:
http://murga-linux.com/puppy/viewtopic.php?p=1026490#1026490
EDIT 2019-04-30 New portable version 0.2 has "Preview in Browser" button:
http://murga-linux.com/puppy/viewtopic.php?p=1026741#1026741
EDIT 2019-05-02 Version 0.3 has gtkdialog GUI
http://murga-linux.com/puppy/viewtopic.php?p=1026936#1026936
==============================================================

I've been looking for a small program to convert Markdown to HTML, there are a lot, but most of them require ruby, perl, python or nodejs (with dependencies), and found this written in C:
https://www.pell.portland.or.us/~orc/Code/discount/
Compiled and made a .pet for it (see attached)
From what I tested it works on old and new 32-bit puppies.
Contains (cli) programs: markdown, mkd2html and makepage.
man markdown
man mkd2html
EDIT: Another way is to use https://dillinger.io/ if you don't mind being dependent on an online service.

As an example to demonstrate for a 2 columns table (as greengeek is looking for a similar thing here):, create a new file "in.md"
Open with text-editor and paste the following in it:
Code:
# Header....

| Personal     |  Work           |
| :----------------|  :--------------- |
|Long text: All on one line, wrapping automatically. All on one line, wrapping automatically All on one line, wrapping automatically. All on one line, wrapping automatically. All on one line, wrapping automatically.|Short text here
|Medium short text, blablablah|Long text: All on one line, wrapping automatically. All on one line, wrapping automatically All on one line, wrapping automatically. All on one line, wrapping automatically. All on one line, wrapping automatically.
|Hi!|Short text
|Text, blablablah|Short text
|Hi!|Short text
||Left column is empty
|Right column is empty|


Or, much more simple (above is mostly for to demonstrate wrap with long text):
Code:
| Applications     |  Others           |
| :----------------|  :--------------- |
|alsamixer-tray|apulse
|azpainter|broadcom-wl-driver-k4.9.0-3-686-pae
|ceni|conky-cli
|conkyclock|conky
|conkyclock2|libpng12-0
|cputemp|libx264-132
|create-portable|emelfm2
|epdfview|gtkdesklet
|deadbeef-static|gtkdialog
|firefox-esr|guessfstype
|dropboxgui|libmusicbrainz3-6


Then (I used mkd2html and added style block):
Code:
# convert markdown to html
mkd2html in.md out.html

# add style block, table-layout: fixed, width: 100%
echo '<style>

table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}

.w {
  width: 100%;
}

</style>
' >> out.html

See pic below for out.html displayed in Firefox.
Much more styling can be done with a more advanced style block of course.

Also you can use mkd2html with -css option, e.g. (pointing to e.g. style.css)
Code:
mkd2html -css style.css in.md out.html

But then out.html is not a standalone html (depends for style on style.css)

Fred
table.png
 Description   
 Filesize   83.23 KB
 Viewed   530 Time(s)

table.png

markdown-discount-2.2.6_i386.pet
Description  Markdown to HTML from command line
pet

 Download 
Filename  markdown-discount-2.2.6_i386.pet 
Filesize  177.86 KB 
Downloaded  70 Time(s) 
markdown-to-html-table.png
 Description   
 Filesize   83.31 KB
 Viewed   532 Time(s)

markdown-to-html-table.png


_________________
Dog Linux website
Tinylinux blog by wiak

Last edited by fredx181 on Thu 02 May 2019, 13:39; edited 7 times in total
Back to top
View user's profile Send private message 
step

Joined: 04 May 2012
Posts: 1181

PostPosted: Tue 23 Apr 2019, 18:03    Post subject:  

Thank you. Another option is Fatdog's mdview, which can display (GTK2) and convert (to decorated text and html) a subset of markdown. Alas, the subset doesn't include tables. Interestingly, it supports multi-language markdown (gettext).
_________________
Fatdog64-802|+Packages|Kodi|Findnrun|+forum|gtkmenuplus
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 5536
Location: Republic of Novo Zelande

PostPosted: Thu 25 Apr 2019, 05:37    Post subject: Re: Markdown to HTML
Subject description: command line program(s): markdown, mkd2html and makepage
 

fredx181 wrote:
Then (I used mkd2html and added style block):
Code:
# convert markdown to html
mkd2html in.md out.html

# add style block, table-layout: fixed, width: 100%
echo '<style>

table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}

.w {
  width: 100%;
}

</style>
' >> out.html

I am not understanding this portion - is this another file? Or is it a script of some kind? Where do i input this code?
cheers!

EDIT - ok, i got it now - i had not installed the pet.
(Have to use
Code:
mkd2html in.md out.html
in a terminal AFTER installing the pet)
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Thu 25 Apr 2019, 06:35    Post subject:  

greengeek wrote:
EDIT - ok, i got it now - i had not installed the pet.
(Have to use
Code:
mkd2html in.md out.html
in a terminal AFTER installing the pet)


Yes, but also adding the style block to out.html may be important, if you want the columns same size (fixed) and the width 100%.

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Thu 25 Apr 2019, 10:22    Post subject:  

Hi All,
fredx181 wrote:
Much more styling can be done with a more advanced style block of course.


Here's attached a little script that makes the markdown > html "github styled"
Took the github "template' (included in script) from markdown-styles here:
https://raw.githubusercontent.com/mixu/markdown-styles/master/layouts/github/assets/css/github-markdown.css

It's usage may need a manual edit of the script, set it on top (input, output and title)

Code:
#######################################
# set input (.md) and output (.html)
IN=/root/in.md
OUT=/root/out.html
TITLE=MarkdownToHTML-Example
#######################################


So,in case keeping the default, before running the script, create "/root/in.md" containing the Markdown code and it will convert to /root/out.html
And depends on having installed the markdown-discount .pet attached at post #1

The script can be much more advanced, just a start to experiment with, for now.

EDIT: Re-attached the script, fixed a bug (earlier version didn't work because I tested with other markdown version)

Fred
mdtohtml.gz
Description  2019-04-29-bugfix mdtohtml script, markdown > html using "github-style", remove fake .gz and make executable
gz

 Download 
Filename  mdtohtml.gz 
Filesize  13.53 KB 
Downloaded  52 Time(s) 

_________________
Dog Linux website
Tinylinux blog by wiak

Last edited by fredx181 on Sat 27 Apr 2019, 03:00; edited 1 time in total
Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 738

PostPosted: Thu 25 Apr 2019, 11:09    Post subject:  

Hello
This is a markdown to .html thread, i know, but I couldn't resist a mock-up using Composer. Forgive me!
html-straight.html.gz
Description  A Composer created mock up. Remove the .gz and open in your browser.
gz

 Download 
Filename  html-straight.html.gz 
Filesize  4.23 KB 
Downloaded  38 Time(s) 

_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM

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


Joined: 20 Jul 2010
Posts: 5536
Location: Republic of Novo Zelande

PostPosted: Fri 26 Apr 2019, 06:02    Post subject: Re: Markdown to HTML
Subject description: command line program(s): markdown, mkd2html and makepage
 

fredx181 wrote:
Then (I used mkd2html and added style block):
Code:
# convert markdown to html
mkd2html in.md out.html

# add style block, table-layout: fixed, width: 100%
echo '<style>

table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}

.w {
  width: 100%;
}

</style>
' >> out.html

I am uncertain how/where/when you are inserting the style block.

When i enter
Code:
mkd2html in.md out.html
in a terminal i get the output file - but as you pointed out I am not adding the style block. I just don't see how/where this is done.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Fri 26 Apr 2019, 09:23    Post subject: Re: Markdown to HTML
Subject description: command line program(s): markdown, mkd2html and makepage
 

greengeek wrote:
fredx181 wrote:
Then (I used mkd2html and added style block):
Code:
# convert markdown to html
mkd2html in.md out.html

# add style block, table-layout: fixed, width: 100%
echo '<style>

table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}

.w {
  width: 100%;
}

</style>
' >> out.html

I am uncertain how/where/when you are inserting the style block.

When i enter
Code:
mkd2html in.md out.html
in a terminal i get the output file - but as you pointed out I am not adding the style block. I just don't see how/where this is done.


Well.. yeah, sorry, I assume too easily that people do the same as me: I always select a code and "paste" in terminal with mouse middle click.
So maybe better make a script from it, or just use a text-editor (leafpad Wink ) to add this (the style block) to the bottom of out.html :
(after done the mkd2html command)
Code:
<style>
table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}

.w {
  width: 100%;
}
</style>


Then it give the same result as what the above echo command would do (echo '<style> .... .... </style> ' >> out.html)

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Sat 27 Apr 2019, 03:09    Post subject:  

Here's a GUI program using yad for to convert markdown to html: md2html-gui
(remove fake .gz extension and make executable)
Depends (obviously) on yad and markdown (commandline utility) the markdown-discount .pet attached in post #1 contains it.

Usage is easy, just type or paste the markdown text in the textarea and select (or type) output file. (see pic).
Currently only Github style available, I may extend it later with more style choices.

Also fixed a bug for the earlier shared (simple) script "mdtohtml", see EDIT here:
http://murga-linux.com/puppy/viewtopic.php?p=1026253#1026253

EDIT: Re-uploaded, added dark theme and changed demo text

Fred
md2html-gui.gz
Description  md2html-gui re-uploaded, added dark theme and changed demo text
(remove fake .gz extension and make executable)
gz

 Download 
Filename  md2html-gui.gz 
Filesize  26.36 KB 
Downloaded  56 Time(s) 
dark-theme.png
 Description   
 Filesize   172.13 KB
 Viewed   279 Time(s)

dark-theme.png

md2html-gui.png
 Description   
 Filesize   95.98 KB
 Viewed   309 Time(s)

md2html-gui.png

example-html.png
 Description   
 Filesize   170.86 KB
 Viewed   311 Time(s)

example-html.png


_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Sat 27 Apr 2019, 18:17    Post subject:  

Portable version of md2html-gui for 32 and 64 bit attached, changes: added more styles (see pic).
Contains yad and the markdown command-line utility, so not needed to have these installed (it's standalone program (self-extracting script) that contains also templates for the different layout styles) .

The created HTML is standalone (has style code included)

Most style css codes I took from here:
https://github.com/mixu/markdown-styles/tree/master/layouts

Fred
md2html-gui-portable.png
 Description   Choice for different styles
 Filesize   110.38 KB
 Viewed   250 Time(s)

md2html-gui-portable.png

md2html-gui-portable32.gz
Description  Portable md2html-gui for 32-bit OS, remove fake .gz and make executable
gz

 Download 
Filename  md2html-gui-portable32.gz 
Filesize  151.7 KB 
Downloaded  52 Time(s) 
md2html-gui-portable64.gz
Description  Portable md2html-gui for 64-bit OS, remove fake .gz and make executable
gz

 Download 
Filename  md2html-gui-portable64.gz 
Filesize  134.1 KB 
Downloaded  55 Time(s) 

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 738

PostPosted: Sun 28 Apr 2019, 07:38    Post subject:  

Fred,
You seem to like the word "portable". I saw you use it regarding "portable firefox", then you and Mike Walsh with "portable seamonkey". And just now ran into "portable md2html-gui". I know English is not your mother tongue, but this repeated use of the word is not consistent with the English meaning of the word. As used in the 3 cases, "portable" is an adjective and I refer you to the Miriam Webster Dictionary. I use neither of your "portable" browsers but have a vague idea that what it does is encapsulates firefox with apulse into a package to allow the newby user a "sound for sure" experience. Admirable, but that's not a "portable" firefox AND I AM NOT THE LANGUAGE POLICE Wink . Seamonkey does not have the pulseaudio sound issues, so I don't know the rationale for a "Portable seamonkey". Did I understand incorrectly that your "package" is a means of putting firefox in /home (nothing new) and combining it with apulse? Neither browser is any more portable to another puppy or anywhere else than the original firefox. How different is it from an application and its dependencies? I don't understand where you see portability. A more appropriate name to reflect the combination of firefox and apulse would IMHO be all-in-firefox or combo firefox or apulsefox or foxapulse or foxsound or ff<something>.

I can't comment on md2html. I note however, that in one post you refer to md2html, then in the very next, md2html-portable. I would only ask: what did you do with md2html to suddenly make it acquire portability? Razz

_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM

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


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Sun 28 Apr 2019, 08:36    Post subject:  

Hi B.K. Johnson,

In my view, portable means that you can boot a puppy, click on the executable file and it runs, boot another puppy and it runs too. Not required to install anything.
I case of md2html, the first (not-portable) was a script that depends on having yad and the markdown-discount pet (from first post attached) installed.
The md2html-portable has these binaries included (also style templates) as I mentioned in my previous post (self-extracting script).

The firefox-portable is a bit different, called it portable because of apulse included and the profile folder inside (instead of /root/.mozilla), but it needs gtk3, which is not installed on most older puppies, so let's call it half-portable Wink

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
B.K. Johnson

Joined: 12 Oct 2009
Posts: 738

PostPosted: Mon 29 Apr 2019, 09:16    Post subject:  

reserved for rebuttal to FredX181 on "portables".
[EDIT April 30/19]
This is not my full reply, but I thought I'd quickly get the point out: you are skating on thin ice legally. Using the name "portable firefox" could be a copyright infringement.

_________________
B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM


Last edited by B.K. Johnson on Tue 30 Apr 2019, 16:21; edited 1 time in total
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3960
Location: holland

PostPosted: Mon 29 Apr 2019, 10:10    Post subject:  

reserved for reply to 'rebuttal to FredX181 on "portables"' from B.K. Johnson Laughing

B.K. Johnson wrote:
reserved for rebuttal to FredX181 on "portables".
[EDIT April 30/19]
This is not my full reply, but I thought I'd quickly get the point out: you are skating on thin ice legally. Using the name "portable firefox" could be a copyright infringement.

Thanks anyway for the warning, but very small chance that it would cause me trouble, firefox is open-source AFAIK, and besides that, this is just hobby/amateur software shared on some forum, no competition for mozilla.

_________________
Dog Linux website
Tinylinux blog by wiak

Last edited by fredx181 on Wed 01 May 2019, 08:39; edited 1 time in total
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 14196
Location: Gatineau (Qc), Canada

PostPosted: Mon 29 Apr 2019, 11:43    Post subject:  

B.K. Johnson wrote:
Hello
This is a markdown to .html thread, i know, but I couldn't resist a mock-up using Composer. Forgive me!

Tested it, and it's a great template. Thanks.
No apologies necessary.
It's the other guys who like to split hairs! Wink

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Browsers and Internet
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.0713s ][ Queries: 12 (0.0126s) ][ GZIP on ]