diff --git a/CuraSettingsGuide.py b/CuraSettingsGuide.py index 825c49c00..34d3720b3 100644 --- a/CuraSettingsGuide.py +++ b/CuraSettingsGuide.py @@ -315,7 +315,7 @@ def isArticleFile(self, filename: str) -> bool: :return: True if the file name is the file name of an existing article, or False if it isn't. """ - return os.path.exists(os.path.join(os.path.dirname(__file__), "resources", "articles", filename)) + return os.path.exists(filename) @pyqtProperty(QObject, constant=True) def containerStack(self) -> Optional[ContainerStack]: diff --git a/QtMarkdownRenderer.py b/QtMarkdownRenderer.py index a6fff2bda..d303eb8b5 100644 --- a/QtMarkdownRenderer.py +++ b/QtMarkdownRenderer.py @@ -43,6 +43,10 @@ def link(self, link, title, text): """ link = mistune.escape_link(link) link_colour = UM.Qt.Bindings.Theme.Theme.getInstance().getColor("text_link").name() + + if "://" not in link and link.endswith(".md"): # Link to a different article. + link = os.path.join(self._images_path, link) + if not title: return "{text}".format(colour=link_colour, link=link, text=text) title = mistune.escape(title, quote=True) diff --git a/resources/qml/ArticleText.qml b/resources/qml/ArticleText.qml index 6b5deadd4..650c744e3 100644 --- a/resources/qml/ArticleText.qml +++ b/resources/qml/ArticleText.qml @@ -16,7 +16,8 @@ Text { onLinkActivated: { if(manager.isArticleFile(link)) { - var article_id = link.replace(/\.[^/.]*$/, "") + var article_id = link.replace(/\.[^/.]*$/, ""); + article_id = article_id.replace(/.*\//, ""); manager.setSelectedArticleId(article_id); } else { Qt.openUrlExternally(link);