markbind icon indicating copy to clipboard operation
markbind copied to clipboard

Panel's pop-up attribute URL calculation is wrong when being included

Open Chng-Zhi-Xuan opened this issue 6 years ago • 4 comments

Tell us about your environment

  • MarkBind Version: 1.8.2

What did you do?

  1. Given a file, A.md that has a Panel with a local URL specified in the pop-up attribute to a file B.md.
  2. Given another file C.md in another directory.
  3. If file C <includes> file A, the URL calculation for the local URL of file B.md will be using file C's directory as a base, which will result in a invalid directory being accessed.

What did you expect to happen? Panel in file A continue using file A's directory for local URL calculation, even after being included in file C.

Reproduced in #277 user guide migration, in the pop-up attribute section in components#panels

Chng-Zhi-Xuan avatar Jun 25 '18 08:06 Chng-Zhi-Xuan

Code: mainPage.md

<include src="docs/index.html" />

docs/index.md

<panel popup-url="loadContent.html">
    ...
</panel>

docs/loadContent.md

File content does not matter.

Expected: The popup that is rendered in mainPage.html should link to docs/loadContent.html.

Actual: The popup links to loadContent.html instead.

yamgent avatar Jun 25 '18 09:06 yamgent

Using {{ baseUrl }} would avoid this problem, right?

<panel popup-url="{{ baseUrl }}/docs/loadContent.html">

damithc avatar Dec 24 '18 11:12 damithc

Using {{ baseUrl }} would avoid this problem, right?

<panel popup-url="{{ baseUrl }}/docs/loadContent.html">

It does, although the main concern is that the problem (and hence the solution) is not immediately obvious to the author.

yamgent avatar Dec 24 '18 11:12 yamgent

It does, although the main concern is that the problem (and hence the solution) is not immediately obvious to the author.

ATM, that is the behavior for any link, not just popup-URL. I came across it here. Yes, we should document it as it is a basic feature.

damithc avatar Dec 24 '18 12:12 damithc