:: Re: [DNG] Questions about markdown
Top Page
Delete this message
Reply to this message
Author: Mike Schmitz
Date:  
To: dng
Subject: Re: [DNG] Questions about markdown
On Mon, Oct 20, 2025 at 01:46:05PM -0400, Dan Purgert via Dng wrote:
> On Oct 20, 2025, Didier Kryn wrote:
> >     Hello guys.
> >
> >     I'm confused with markdown files. Essentially I'm concerned with
> > README.md like one can find in any git store, like git.devuan.org.
> >
> >     1) If I write a file in the Markdown format, my browser doesn't know how
> > to display it.
>
> As I recall, raw markdown should generically be identified as
> text/markdown, which (insofar as I understand mimetypes) should result
> in a browser treating it pretty much like text/plain -- i.e. show it on
> the page as "plain text" (as opposed to attempting to download it,
> etc.). I suppose if something's gone awry, it might identify it as
> application/octet-stream.
>
> >
> >     2) If I point my browser to the same file through a server at localhost,
> > it still can't display it.
>
> Not 100% sure what you mean here, are you getting a 404 or something?
>
> >
> >     3) If I point the same browser to some README.md file in the git store,
> > now it can display it.
>
> I'm going to assume you mean the project repository on
> git{hub,lab,ea,...}. If not, could you clarify what you mean by "git
> store"?
>
> >
> >     4) If I look at the content of the README.md file, it is just plain
> > HTML!
>
> This doesn't make any sense, a markdown file should be plain text (see
> above).
>
> Wait, do you mean that you're doing "view -> source" on a webpage
> that is displaying rendered markdown?
>
> If the latter, that makes total sense -- the data has to be rendered
> server-side before you get a "web-page". Think the equivalent of PHP or
> other CGI-scripted websites.
>
> >
> >     Is somebody lying, or is there some mechanism in the servers which
> > convert md to html, or what else?
>
> Sounds like it may just be a gap in understanding (maybe)
>
> Markdown isn't something that's interpreted by your browser, but rather
> something serverside (apache2 would need the markdown module; IIRC
> something along the lines of 'libapache2-mod-md' in the package repos).


for viewing .md files in less, I have this in my .lessfilter file:

case "$1" in
  *.md)
    pandoc "$1" | lynx -stdin -dump
  ;;
  *)
    # We don't handle this format.
    exit 1
esac


exit 0

HTH
Mike Schmitz