In markdown we can reference other sections(heading) from same page using anchor #. so if url returned from onSearchLink starts with # it should be allowed without adding https://.
using full URL is not always possible, we should be able to use relative urls for reference.
Here is the diff that solved my problem:
diff --git a/node_modules/rich-markdown-editor/dist/components/LinkEditor.js b/node_modules/rich-markdown-editor/dist/components/LinkEditor.js
index 9848f2f..af59daa 100644
--- a/node_modules/rich-markdown-editor/dist/components/LinkEditor.js
+++ b/node_modules/rich-markdown-editor/dist/components/LinkEditor.js
@@ -62,7 +62,7 @@ class LinkEditor extends React.Component {
return;
this.discardInputValue = true;
const { from, to } = this.props;
- if (!isUrl_1.default(href) && !href.startsWith("/")) {
+ if (!isUrl_1.default(href) && !href.startsWith("/") && !href.startsWith("#")) {
href = `https://${href}`;
}
this.props.onSelectLink({ href, title, from, to });
Hi! 👋
In markdown we can reference other sections(heading) from same page using anchor
#
. so if url returned fromonSearchLink
starts with#
it should be allowed without addinghttps://
.using full URL is not always possible, we should be able to use relative urls for reference.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.