-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
[Plugin][FR]: Remove .md extension from generated links #176
Comments
Real question: did you try to use the regex replacement of contents to remove the .MD extension? Probably something with See https://regex101.com/r/2xMqDG/1 You can remove the |
Hi @Lisandra-dev, Great question - this may very well be a case of user error! I'll give the above suggestion a try, but given that use of backslashes yields an error (see #172), I'll need to wait until the new release to begin testing. Thanks for your prompt response! Very much appreciate the help here. |
As I said in my first post, you need to set the regex in the content remplacement. Not in the path remplacement. |
Hi @Lisandra-dev, Ah, thank you - I'll read more carefully next time. Hmmm... it seems the following settings in the I've verified I might have to do some debugging on my end to see what might be going awry. In any case, here's my settings and test content, in case anything jumps out at you. Settings{
"github": {
"branch": "main",
"automaticallyMergePR": true,
"tokenPath": "%configDir%/plugins/%pluginID%/env",
"api": {
"tiersForApi": "Github Free/Pro/Team (default)",
"hostname": ""
},
"workflow": {
"commitMessage": "[Obsidian GitHub Publisher] Merge",
"name": ""
},
"verifiedRepo": true
},
"upload": {
"behavior": "yaml",
"defaultName": "docs",
"rootFolder": "",
"yamlFolderKey": "publish-path",
"frontmatterTitle": {
"enable": true,
"key": "publish-filename"
},
"replaceTitle": [
{
"regex": "/\\s+/",
"replacement": "-",
"type": "title"
}
],
"replacePath": [],
"autoclean": {
"enable": false,
"excluded": []
},
"folderNote": {
"enable": false,
"rename": "index.md"
},
"metadataExtractorPath": ""
},
"conversion": {
"hardbreak": false,
"dataview": true,
"censorText": [
{
"entry": "/\\.md/",
"replace": "//",
"after": false
},
{
"entry": ".md",
"replace": "",
"after": false
},
{
"entry": "/\\((.*)\\.md(.*)\\)/",
"replace": "/$1$2/",
"after": false
},
{
"entry": "/\\.md/",
"replace": "",
"after": false
}
],
"tags": {
"inline": false,
"exclude": [],
"fields": []
},
"links": {
"internal": true,
"unshared": false,
"wiki": true,
"slugify": true
}
},
"embed": {
"attachments": true,
"keySendFile": [],
"notes": true,
"folder": ""
}
} Test file contents (In Obsidian):test-blog-post.md---
publish: true
publish-path: blog/2022
publish-filename:
---
[[test-docs-post]] test-docs-post.md---
publish: true
publish-path: docs
publish-filename:
---
[[test-blog-post]] Result (In GitHub)test-blog-post.md---
publish: true
publish-path: blog/2022
publish-filename:
---
[test-docs-post](../../docs/test-docs-post.md#) test-docs-post.md---
publish: true
publish-path: docs
publish-filename:
---
[test-blog-post](../blog/2022/test-blog-post.md#) |
Change the arrow to down :) |
Ah, shoot. Thank you @Lisandra-dev! Changing the arrow to down resolved my issue. I've provided the full resolution below for anyone with similar inquiries. Solution (to remove
|
What do you mean by the links in dataview ? |
Tables in dataview have a link called |
No problem on my side :/ Here my settings tested: "conversion": {
"hardbreak": false,
"dataview": true,
"censorText": [
{
"entry": "/(\\[.*?\\]\\(.*?).md(.*?\\))/",
"replace": "$1$2",
"flags": "",
"after": true
}
],
"tags": {
"inline": false,
"exclude": [],
"fields": []
},
"links": {
"internal": true,
"unshared": true,
"wiki": true,
"slugify": false
} |
mine is this:
in your screenshot, it seems that only the first row of the table was replaced but other links are still with |
Oh, yeah, I think you need to use |
I have added g at the end. but no matter if it is added or unadded. .md is still not being replaced. |
I rebuilt my repo and it is working now. thanks. |
Issue validation
Is your feature related to a problem ?
I recently confirmed that Docusaurus does not support relative markdown linking between blog and doc pages.
This means that the relative markdown links (
[link](../../docs/.md#)
) generated by the Obsidian GitHub Publisher plugin do not work for links between pages in theblog
section and thedocs
section any Docusaurus website. This might be fixed in the future, but one of the lead developer's notes that this would require a significant change to how links are routed in Docusaurus.However, using standard URL links (without the
.md
extension) work just fine.For example:
If I provide a link in a blog post like
[link](../../docs/relevant-doc-page.md#)
, the link does not work.whereas...
When I remove the
.md
extension ([link](../../docs/relevant-doc-page)
), the link routes successfully.What solution do you want to see ?
As a workaround, I'd like an option to remove the
.md
extension from all wikilinks that are converted to relative markdown links, so these links work properly on websites built with Docusaurus.So instead of:
[link](../../docs/relative-doc-page.md#)
It should be:
[link](../../docs/relative-doc-page)
This could be a matter of including the file extension in any user-specified regular expressions in the
Apply edit on the folder path or filename (automatically)
setting, allowing users to remove the.md
file extension by specifying.md
underValue to replace
and nothing for theReplacement
value.Describe the alternative you've considered
Other solutions might look like:
Omit .md file extension?
) in theContent's conversion
section to omit the.md
file extension for any[[Wikilinks]]
that are converted to[MDlinks](links)
.OS
Windows
Anything else?
I think enabling the ability to modify file extensions (in addition to filename and folder path) in the
Apply edit on the folder path or filename (automatically)
setting would be the most flexible solution. However, this may or may not cause issues in the event that users' existing regex replace settings happen to match the.md
file extension.Plugin version
6.2.5
Obsidian version & debug log
The text was updated successfully, but these errors were encountered: