internal links in markdown preview window are broken #1259

Open
opened 2026-02-05 00:25:35 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @bitinerant on GitHub (Jul 14, 2019).

Describe the bug
In the markdown page editor, I can create an internal like like [link1](page1). When I save the page, clicking this link will correctly take me to page1 in the same book. However, while editing the markdown, in the preview section on the right, clicking the link takes me to an invalid page.

Steps To Reproduce

  1. In Settings, set the page editor to "Markdown"
  2. Create a new page called "page1" and save it
  3. On a different page in the same book, add the link: [link1](page1)
  4. Click on the "link1" link in the preview section on the right - it will take you to an invalid page, e.g. https://example.com/books/apple/page/page2/page1
  5. Save the page and click "link1' - it will work as expected

Expected behavior
Step 4 will take you to page1, e.g. https://example.com/books/apple/page/page1

Your Configuration (please complete the following information):

  • Exact BookStack Version: BookStack v0.26.2
  • Hosting Method (Nginx/Apache/Docker): ran installation-ubuntu-18.04.sh script in LXD container with Ubuntu 18.04
Originally created by @bitinerant on GitHub (Jul 14, 2019). **Describe the bug** In the markdown page editor, I can create an internal like like `[link1](page1)`. When I save the page, clicking this link will correctly take me to page1 in the same book. However, while editing the markdown, in the preview section on the right, clicking the link takes me to an invalid page. **Steps To Reproduce** 1. In Settings, set the page editor to "Markdown" 2. Create a new page called "page1" and save it 3. On a different page in the same book, add the link: `[link1](page1)` 4. Click on the "link1" link in the preview section on the right - it will take you to an invalid page, e.g. `https://example.com/books/apple/page/page2/page1` 5. Save the page and click "link1' - it will work as expected **Expected behavior** Step 4 will take you to page1, e.g. `https://example.com/books/apple/page/page1` **Your Configuration (please complete the following information):** - Exact BookStack Version: BookStack v0.26.2 - Hosting Method (Nginx/Apache/Docker): ran `installation-ubuntu-18.04.sh` script in LXD container with Ubuntu 18.04
Author
Owner

@ssddanbrown commented on GitHub (Jul 15, 2019):

Thanks for the clear steps @bitinerant.

To be totally honest, It's more of a coincidence that this works when viewing the page rather than being something that's specifically broken in the markdown editor preview. A partial link as used will simply be relative to the currently URL, hence the behaviour difference from different locations.

Quick tip: You can use (Ctrl + Shift + K) on windows/linux to select another page to link to, This will insert a full link to that item which will work consistently when viewing pages & when in the editor.

@ssddanbrown commented on GitHub (Jul 15, 2019): Thanks for the clear steps @bitinerant. To be totally honest, It's more of a coincidence that this works when viewing the page rather than being something that's specifically broken in the markdown editor preview. A partial link as used will simply be relative to the currently URL, hence the behaviour difference from different locations. Quick tip: You can use (Ctrl + Shift + K) on windows/linux to select another page to link to, This will insert a full link to that item which will work consistently when viewing pages & when in the editor.
Author
Owner

@bitinerant commented on GitHub (Jul 15, 2019):

Still, if there is a way to make the links work correctly, it would be a feature I would use often. If you type the markdown link [link1](../page1) then it works correctly in the preview window (but not in the saved page), so perhaps there is a way to 'trick' the preview into working.

Thanks for the explanation and quick tip, @ssddanbrown .

@bitinerant commented on GitHub (Jul 15, 2019): Still, if there is a way to make the links work correctly, it would be a feature I would use often. If you type the markdown link `[link1](../page1)` then it works correctly in the preview window (but not in the saved page), so perhaps there is a way to 'trick' the preview into working. Thanks for the explanation and quick tip, @ssddanbrown .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1259