Page 1 of 1

markdown tools/file format converters

Posted: Mon Nov 02, 2020 9:49 am
by wiak

I today noted a thread started by rockedge re using markdown for this Puppy Linux phpBB website: viewtopic.php?p=9010#p9010

In the past I used to write quite a bit in html (including making two or three column fluid/auto-sizing layouts using css). However, aside from some tweaks or quick additions, I rarely do so any more. I do however continue to create websites, such as https://tinylinux.info (which I keep meaning to update on a regular basis), but nowadays I use markdown files plus static site generator software for most of that.

This post is simply about some markdown tools/converters I find useful. In practice, as I've posted about previously, I tend to rely on cherrytree hierarchical notekeeper for keeping notes concerning anything I'm developing, but that can export node pages to html, which can then be converted into markdown using some of the tools below. Alternatively, any generated markdown can be exported into html (or, for example pdf). Just a short list to get things going for further discussion and additions of others:

Online web-based apps:

https://github.com/benweet/stackedit
https://stackedit.io/
Full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.

https://github.com/joemccann/dillinger
https://dillinger.io/
One thing I really like about Dillinger is that it has the great feature that it can not only render markup or export as html or pdf, but also can import html file and produce markup (some limitations admittedly).

Downloadable apps:

https://github.com/jamiemcg/remarkable
http://remarkableapp.github.io/
Remarkable is an open source Markdown Editor for Linux. You can download the latest version from the project site. It is also available on the AUR.

https://github.com/domchristie/turndown
http://domchristie.github.io/turndown/
This one is for html into markdown (can change some of the markdown syntax via selections). I find this really useful copying some cherrytree node contents via html export into markdown format. The second link for turndown above is an online demo (you can use that without installing in other words).

Another particularly useful resource is:
pandoc.org
If you need to convert files from one markup format into another, pandoc is your swiss-army knife.

wiak


Re: markdown tools/file format converters

Posted: Mon Nov 02, 2020 2:09 pm
by rockedge

I have compiled the two pane Markdown editor CuteMarkED in Bionic64 and Fossapup64. Testing has started and if all goes well it will be provided here!

Available here : viewtopic.php?p=9086#p9086


Re: markdown tools/file format converters

Posted: Mon Nov 02, 2020 5:45 pm
by sc0ttman

Here is a PERL script.

It is an updated version of the original Markdown.pl script, which was written by the guy who invented Markdown.

Here is the link: https://github.com/mackyle/markdown

The changes are that this one supports "GitHub flavoured" Markdown - which adds supports for tables, emojis, and other stuff.

Usage:

How to write in Markdown: https://github.com/mackyle/markdown/blo ... /basics.md

Converting the Markdown to HTML:

Code: Select all

cat file.md | Markdown.pl                 # print HTML to console

cat file.md | Markdown.pl > file.html     # write HTML to file

Re: markdown tools/file format converters

Posted: Tue Nov 03, 2020 7:19 am
by step

I use lowdown to convert markdown to man pages, htlm5 and terminal output. It's much simpler to build than pandoc. It's also less powerful. (Fatdog64 users: it's in the repo).

Vivaldi browser has a built-in notes editor that understands markdown. It's nice when you need to combine multiple web texts and don't want to jump between multiple windows. There's also a built-in screenshotter.

Rstudio is a very sophisticated markdown composer (build sites, write books, research articles, etc.) but the learning curve is steep because rstudio is a data science IDE, so you need to learn how to load modules and some echo system before you can be productive.

HastyScribe is a command-line program to convert markdown to self-contained HTML with embedded images and a table of contents. I wrote this wrapper script that adds a help screen and some extras.


Re: markdown tools/file format converters

Posted: Tue Nov 03, 2020 12:51 pm
by sc0ttman

Thanks step, lowdown looks nice.

Another way to view markdown in the terminal is this:

Get the markdown file, use Markdown.pl to convert to HTML, then view it in a terminal browser like lynx or w3m.

(Optionally convert the HTML to nicely formatted plain text with w3m -dump file.html)

I made use of these techniques in a script called github_readme.sh, which lets me read nicely formatted GitHub READMEs on the terminal.

Here is the relevant snippet:

Code: Select all

for version in $branch_or_commit master main develop testing
do

  [ -f /tmp/ghreadme.md ] && rm /tmp/ghreadme.md

  readme_url="https://raw.githubusercontent.com/${repo}/${version}/README.md"

  # crawl the url
  wget --timeout=2 --spider -S -o /tmp/ghreadme.md "$readme_url"

  # get the status code
  grep -m1 'HTTP/[1-3].[0-9] [0-9][0-9][0-9]' /tmp/ghreadme.md | grep -E '200 OK' > /tmp/ghresponse

  # if HTTP status not 200, skip this url
  grep -q -m1 "200" /tmp/ghresponse || continue


  # get the raw markdown, convert it to HTML
  w3m "$readme_url" | Markdown.pl > /tmp/ghreadme.html

  # pad the HTML with proper title and encodings
  echo "<html>
    <head>
      <title>$repo README</title>
      <meta charset=\"UTF-8\">
    </head>
      <body>
        $(cat /tmp/ghreadme.html)
      </body>
    </html>" > /tmp/gh-README.html

  if $showhtml
  then
    # skip if HTML file is empty
    [ ! -s /tmp/gh-README.html ] && rm /tmp/gh-README.html && continue
    ${TERM_BROWSER:-w3m} /tmp/gh-README.html && break
  else
    # convert the HTML to plain text
    w3m -graph -dump /tmp/gh-README.html > /tmp/gh-README.txt
    # skip if plain text file is empty
    [ ! -s /tmp/gh-README.txt ] && rm /tmp/gh-README.txt && continue
    # read the README
    ${PAGER:-less} /tmp/gh-README.txt && break
  fi

done

Re: markdown tools/file format converters

Posted: Fri Nov 06, 2020 9:58 am
by step

HastyScribe is a command-line program to convert markdown to self-contained HTML with embedded images and a table of contents. I wrote this wrapper script that adds a help screen and some extras.


Re: markdown tools/file format converters

Posted: Fri Nov 06, 2020 10:43 am
by fredx181

Here's also a simple markdown to html converter (gtkdialog GUI) that I wrote some time ago:
http://murga-linux.com/puppy/viewtopic. ... 65#1062065

Fred


Re: markdown tools/file format converters

Posted: Fri Sep 23, 2022 2:44 pm
by mikeslr

zuzia has posted about MarkText, MarkText - Best free Markdown Editor :) here, https://www.forum.puppylinux.com/viewto ... 491#p67491


Re: markdown tools/file format converters

Posted: Sat Feb 10, 2024 2:03 am
by williwaw

while looking for lightweight format converters I found a couple that work in the browser/
these simple converters work off-line (there are ones similar that online that have more functions)

Paste 2 Markdown takes formatted text, maybe something copied from a web page or another app, and converts it to markdown when pasted into the page with Ctrl v
https://euangoddard.github.io/clipboard2markdown/

Minimalist Online Markdown Editor take markdown formatted text and outputs the parsed results in a dual pane editor, or can also convert/output html.
http://markdown.pioul.fr/

both pages can be saved to disk and bookmarked for use offline

also,
mdv is a handy utility for viewing a markdown file in the terminal
https://pypi.org/project/mdv/


Re: markdown tools/file format converters

Posted: Sat Feb 10, 2024 2:39 pm
by rockedge

I use MarkText as well. Works well on KLV's and the Puppy's I work with.