0

Both relative and absolute paths are found within Emacs editor. That is, referring to the code below, if I click on Rel to foo/foo.md inside bar.md, it'll change the buffer to foo.md, and conversely. I publish *md with C-c C-c p. That opens a tab in the browser. Only the absolute paths are valid. How to get the relative paths to work properly?

Paths:

~/Documents/dev/emacs/toy $ ls markdown/*
markdown/bar~  markdown/bar.md  markdown/bar.md~

markdown/foo:
foo.md  foo.md~

bar.md:

[Rel to foo/foo.md](./foo/foo.md)

[Abs to foo/foo.md](/home/er/Documents/dev/emacs/toy/markdown/foo/foo.md)

Corresponding html:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>*markdown-output*</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

</head>

<body>

<p><a href="./foo/foo.md">Rel to foo/foo.md</a></p>
<p><a href="/home/er/Documents/dev/emacs/toy/markdown/foo/foo.md">Abs to foo/foo.md</a></p>

</body>
</html>

foo.md:

[Rel to foo/foo.md](./foo/foo.md)

[Abs to foo/foo.md](/home/er/Documents/dev/emacs/toy/markdown/foo/foo.md)

Corresponding html:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>*markdown-output*</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

</head>

<body>

<p><a href="../bar.md">Rel to bar</a></p>
<p><a href="/home/er/Documents/dev/emacs/toy/markdown/bar.md">Abs to bar</a></p>

</body>
</html>

Browser:

$ firefox --version
Mozilla Firefox 65.0.1

Doc converter:

$ pandoc --version
pandoc 2.7.3

Emacs:

$ emacs --version
GNU Emacs 25.2.2

enter image description hereenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.