Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note on absolute links #2507

Merged
merged 24 commits into from Apr 16, 2024
Merged

Add note on absolute links #2507

merged 24 commits into from Apr 16, 2024

Conversation

jingting1412
Copy link
Contributor

@jingting1412 jingting1412 commented Apr 8, 2024

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:
#9 and #278

When including contents with links, {{baseUrl}} is required to be added to the link if the user wants it to point to the absolute location. Without this note, some users might not realise this can result in broken links as shown in issue #278

Anything you'd like to highlight/discuss:

Testing instructions:
markbind serve -d the docs the see if the warning message under the includes section is clear.

Proposed commit message: (wrap lines at 72 characters)
Add note on URLs in includes


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

Reviewer checklist:

Indicate the SEMVER impact of the PR:

  • Major (when you make incompatible API changes)
  • Minor (when you add functionality in a backward compatible manner)
  • Patch (when you make backward compatible bug fixes)

At the end of the review, please label the PR with the appropriate label: r.Major, r.Minor, r.Patch.

Breaking change release note preparation (if applicable):

  • To be included in the release note for any feature that is made obsolete/breaking

Give a brief explanation note about:

  • what was the old feature that was made obsolete
  • any replacement feature (if any), and
  • how the author should modify his website to migrate from the old feature to the replacement feature (if possible).

Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jingting1412 thanks for the work!

I think this issue about using baseUrl isn't just applicable to includes. It also affects panels, modals etc which use links.

Could you update those areas also? Gentle reminder to use includes to avoid duplication.

Would be also good to add it to troubleshooting section in our user guide

@jingting1412
Copy link
Contributor Author

Hi @jingting1412 thanks for the work!

I think this issue about using baseUrl isn't just applicable to includes. It also affects panels, modals etc which use links.

Could you update those areas also? Gentle reminder to use includes to avoid duplication.

Would be also good to add it to troubleshooting section in our user guide

Yep for sure! I've added the tip in more places where I think its relevant and the troubleshooting section. Do let me know if I need to refine my explanation or add the tip to more places.

Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jingting1412 thanks for the work! Some nits :)

docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
<div id="baseUrl-warning">
<box type="warning" header="Add `{{ '{{ baseUrl }}' }}` to local URLs to always point to the same target!">

For links within `<include>` to always point to the same target, make it an absolute link with `{{ '{{ baseUrl }}' }}` included.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you include a negative example so users know what what not to do as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep sure included! lmk if its not clear or anything

docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
To solve this, change the relative URL into an **absolute** URL by adding `{{ '{{ baseUrl }}' }}`. This will ensure that the link will always point to the same address regardless of the page it is included in.

###### Example: Adding `{{ '{{ baseUrl }}' }}` to make absolute URLs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a box here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep sure I have included it now!

###### Example: Adding `{{ '{{ baseUrl }}' }}` to make absolute URLs

If file `folder1/file1.md` contains an absolute link `{{ '{{ [link]({{ baseUrl }}/folder1/target.html) }} ' }}`, when `file1.md` is included in `folder2/file2.md`, the link will point to `folder1/target1.html` even if the target is not in the same directory as `file2.md`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is the same as other parts. Could we use includes to reduce duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep sure, the example can now be included using includes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using include from the include section, I was thinking whether we should create one that is more generic since user may be confused by the mentions of include? Wdyt? @jingting1412 @yucheng11122017

jingting1412 and others added 5 commits April 11, 2024 17:16
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jingting1412 thanks for the work! I think the formatting and so on is good.

I would prefer a more concrete example for the example we provide though (see suggestions). What do you think!

docs/userGuide/troubleshooting.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
jingting1412 and others added 6 commits April 12, 2024 17:47
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Copy link
Contributor

@kaixin-hc kaixin-hc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not so sure on the look of the box.

Based off of @EltonGohJH 's comments, I added some suggestions on how to rephrase it so it sounds a bit more generic...

@@ -71,6 +71,8 @@
</variable>
</include>

<include src="includes.md#baseUrl-warning"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-04-12 at 8 34 22 PM When embedded, it seems like the warning is very large and disrupts the flow of the text. Actually, even when it's not included the placing feels a little awkward. What if all or some of the content was in an expandable panel, so that it's out of the way? Just the header might be good? I suppose you could also experiment with having the example be expandable instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep sure, I've put the example into a panel and changed the explanation to make it more clear! I think since this issue is about links breaking when being included with <include>, the note at the includes section in the UG and troubleshooting section is also just about this specific problem.

If there's another cause to the link breaking issue other than include I think we can make a more generic one?

docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for some nits :)

docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
docs/userGuide/syntax/includes.md Outdated Show resolved Hide resolved
jingting1412 and others added 5 commits April 13, 2024 00:15
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
@kaixin-hc
Copy link
Contributor

@jingting1412 hi, refer to this image for what i mean about weird spacing... could you add a new line where it makes sense to avoid this kind of 0 margin case?

Screenshot 2024-04-15 at 12 04 21 AM

And this warning is redundant.

Screenshot 2024-04-15 at 12 07 02 AM

Thanks!

@jingting1412
Copy link
Contributor Author

@jingting1412 hi, refer to this image for what i mean about weird spacing... could you add a new line where it makes sense to avoid this kind of 0 margin case?

Screenshot 2024-04-15 at 12 04 21 AM And this warning is redundant. Screenshot 2024-04-15 at 12 07 02 AM Thanks!

Hi thanks for the spot! I've fixed those areas now

Copy link
Contributor

@yucheng11122017 yucheng11122017 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@Tim-Siu Tim-Siu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added documentation looks very clear. The only complaint is that the border between the panel and the box boundary is slightly wider than what I prefer, but that is not the problem with this PR.
Screenshot 2024-04-16 at 23 09 18

@Tim-Siu Tim-Siu merged commit fc776ba into MarkBind:master Apr 16, 2024
7 checks passed
Copy link

@Tim-Siu Each PR must have a SEMVER impact label, please remember to label the PR properly.

@Tim-Siu Tim-Siu added c.Enhancement p.Low a-Documentation 📝 pr.DocsUpdate 📃 Pure changes to the documentation, such as typo, restructuring, etc d.moderate r.Patch Version resolver: increment by 0.0.1 labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-Documentation 📝 d.moderate p.Low pr.DocsUpdate 📃 Pure changes to the documentation, such as typo, restructuring, etc r.Patch Version resolver: increment by 0.0.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants