tag:support.fletcherpenney.net,2013-02-12:/discussions/questions/98-converting-local-file-links-from-md-to-htmlMultiMarkdown: Discussion 2018-11-09T16:47:38Ztag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-20T23:49:43Z2014-03-20T23:49:44ZConverting local file links from md to html<div><p>I am trying to use MMD to maintain and update a set of static
web pages, so I can develop them locally and then periodically
upload to a work server. Trying to keep this very simple. The idea
is to write content in markdown for each constituent page, and
develop css file and top-matter separately, and just paste the
latter in with a cat command. As well as external URLs, I have lots
of cross-links between the pages of course. All the pages start as
.md files. So far so cool, as I can preview the whole linked
structure using Marked. Then with MMD I batch convert all the .md
files to .html, and add the boilerplate. Good so far. Then we have
the snag ... inside each html file, the references are to the .md
files, not to the .html files !!</p>
<p>Have I missed something ? I looked at the command line options
and none of them seemed to be "convert md references to html
references". Guess I could do it with sed or something, but this
issue might have already been solved...</p></div>altag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T00:17:29Z2014-03-21T00:17:29ZConverting local file links from md to html<div><p>I'm not sure I follow you.</p>
<p>What is a "md reference"?</p>
<p>Why not just link to the html version from the beginning?</p>
<p>F-</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T00:29:42Z2014-03-21T00:32:56ZConverting local file links from md to html<div><p>By md reference I mean the md file contains a link to a local
file eg</p>
<p><a href="filename.md">some text</a></p>
<p>This gets converted to<br>
<a href="filename.md">some text</a></p>
<p>whereas filename.md has become filename.html; so I want the html
code to say</p>
<p><a href="filename.html">some text</a></p>
<p>.... oh, and I don't want to refer to the html file in the
beginning, because I want to preview the whole suite of md files
using Marked..</p></div>altag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T01:07:51Z2014-03-21T01:07:51ZConverting local file links from md to html<div><p>Ok...</p>
<p>So why not make the link to filename.html from the beginning?
I'm not<br>
sure what the link to filename.md is supposed to mean, if that's
not<br>
where you actually want the link to end up.</p>
<p>MMD basically assumes you know what you're doing. If you tell it
to<br>
link to X, it links to X. It doesn't change X to Y because it wants
to<br>
guess what you really meant.</p>
<p>F-</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T01:07:56Z2014-03-21T01:07:56ZConverting local file links from md to html<div><p>I'm not sure I follow you.</p>
<p>What is a "md reference"?</p>
<p>Just link to the html in the first place.</p>
<p>;)</p>
<p>F-</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T07:38:39Z2014-03-21T07:38:39ZConverting local file links from md to html<div><p>Well I guess I will give up but will just explain the intention
one more time, just so you don't think I'm completely nuts!</p>
<p>Step-1. I am developing a set of interlinked documents entirely
in md and previewing them in Marked. This works nicely. It requires
all the pages being .md files, otherwise you jump to browser when
you click on a link rather than staying in Marked. (BTW, this is
also how I keep notes, using markdown as a kind of desktop
wiki)</p>
<p>Step-2. When that structure is ready, I want to add top matter
and batch-convert all the md files to html files, and the md
references to html references. Then I have the same
linked-structure working as a set of browser-viewable web pages
rather than a set of Marked-viewable md pages.</p>
<p>Now of course I can link to the html in the first place, and
convert the .md files to .html files one by one as I make them, and
preview in the browser all the time. But then I lose the ability to
preview everything in Marked first, which I like a lot.</p>
<p>You are right of course that MMD can't guess your intention, but
that's what switches are for, so you can tell a command your
intention. I can do it by hand with a bit of sed or something I
guess, so that's probably what I will do.</p></div>altag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-03-21T13:32:29Z2014-03-21T13:32:29ZConverting local file links from md to html<div><p>Gotcha.</p>
<p>What you're describing is a feature/loophole in Marked, not
anything related to MultiMarkdown per se.</p>
<p>I think the best approach here is a sed script or something
similar, as you mentioned.</p>
<p>Thanks!</p>
<p>Sent from my iPhone</p></div>fletchertag:support.fletcherpenney.net,2013-02-12:Comment/321960712014-07-22T23:01:06Z2014-07-22T23:01:08ZConverting local file links from md to html<div><p>Al, were you able to figure out a general solution or sed
script? I have a similar problem and am interested in the results.
Thanks!</p></div>DF