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:
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.
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.
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 theHashLocationStrategy
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 thePathLocationStrategy
, 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 theopenLinksInNewWindow
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:
openLinksInNewWindow
option to take an optional parameter that lets it know a single page application is being used withPathLocationStrategy
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.#/content-page/about-the-project#Troubleshooting
.Let me know if you need more information about anything else.