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

Setting and using internal links in Angular #947

Open
Nightsphere opened this issue Aug 5, 2022 · 0 comments
Open

Setting and using internal links in Angular #947

Nightsphere opened this issue Aug 5, 2022 · 0 comments

Comments

@Nightsphere
Copy link

Angular version: 13.2.1
Showdown version: 1.9.1

I'm currently using Showdown in an Angular project using the default PathLocationStrategy. We were previously using the HashLocationStrategy which added a # at the beginning of the project's URL, e.g. domain.org/#/path/to/component. On a given "page" (it's a single page application) Showdown is being used to display markdown with internal links to other pages in the application.

In the past they just so happened to work because we would create a link like so: [Another page](#/map/map-id). Now that we've transitioned to the PathLocationStrategy, the hash is removed and we would also like to remove the # from the markdown internal links. Removing the hash seemed to work except for one issue: I use the openLinksInNewWindow option for external links, but now that the hash has been removed to other pages in the app, the code logic determines it to be external. I found the line in links.js that only considers a path that starts with a hash to be internal.

I have two questions at this point:

  1. I know it seems like a bit to for you guys to worry about, but is there a way for the openLinksInNewWindow option to take an optional parameter that lets it know a single page application is being used with PathLocationStrategy so that it doesn't have to start with hash? I'm not sure if looking for a link that starts with http, https, www is enough.
  2. If the above is too much work for such a little thing and the hash is required no matter what, would anchors work in the link? In that case, the link would contain two hashes, e.g. #/content-page/about-the-project#Troubleshooting.

Let me know if you need more information about anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant