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

[Bug]: When "Sluglify anchor in markdown links" is turned on, the Chinese characters of the anchor content will be deleted. #285

Closed
3 tasks done
miaogaolin opened this issue Jan 26, 2024 · 4 comments
Assignees
Labels
🐛 Bug Something isn't working

Comments

@miaogaolin
Copy link

miaogaolin commented Jan 26, 2024

Issue validation

  • I checked the issue to prevent duplicate
  • I checked my configurations files and the documentation
  • My issue concern doesn't concern the Mkdocs template

Command used

No response

Plugin version

6.12.5

Describe the bug

image

It should be caused by the slugify function

How to reproduce ?

No response

Minimal Reproducible Example

[[test#图片占位符]]

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": false,
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "yaml",
    "defaultName": "content/posts",
    "rootFolder": "content",
    "yamlFolderKey": "dir",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "enable": false,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md",
      "addTitle": {
        "enable": false,
        "key": "title"
      }
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": false,
    "dataview": true,
    "censorText": [
      {
        "entry": "/\\]\\(([^)\\.]+)\\.md/",
        "replace": "]({{< relref \"$1.md\" >}}",
        "flags": "",
        "after": true,
        "inCodeBlocks": false
      },
      {
        "entry": "/cover\\.image/",
        "replace": "cover:\\n    image",
        "flags": "",
        "after": false
      },
      {
        "entry": "/\\]\\(([^/]+?)\\.(png|jpg|jpeg|webp|gif)/",
        "replace": "](/images/$1.$2",
        "flags": "",
        "after": true
      },
      {
        "entry": "/\\!\\[\\[([^/]+?)\\.(png|jpg|jpeg|webp|gif)\\|(\\d+)(x(\\d+))?\\]\\]/",
        "replace": "{{< figure src=\"/images/$1.$2\"  width=\"$3\" height=\"$5\">}}",
        "flags": "",
        "after": false
      },
      {
        "entry": "/\\!\\[\\[([^/]+?)\\.(png|jpg|jpeg|webp|gif)\\|([^\\|]*?)(\\|(\\d+)(x(\\d+))?)?\\]\\]/",
        "replace": "{{< figure src=\"/images/$1.$2\" caption=\"$3\" width=\"$5\" height=\"$7\">}}",
        "flags": "",
        "after": false
      }
    ],
    "tags": {
      "inline": true,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": false,
      "unshared": false,
      "wiki": true,
      "slugify": true
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [],
    "keySendFile": [],
    "notes": false,
    "folder": "static/images",
    "convertEmbedToLinks": "keep",
    "charConvert": "->",
    "forcePushAttachments": [],
    "useObsidianFolder": false
  }
}

Relevant log output

No response

OS

Windows

Anything else?

No response

Obsidian information

v1.5.3
@miaogaolin miaogaolin added the 🐛 Bug Something isn't working label Jan 26, 2024
@Lisandra-dev
Copy link
Member

I'm sorry, it's seems that the package slugify is in the cause. As it not mine, I think you must open an issue on this repository instead of mine.

@miaogaolin
Copy link
Author

Can this solution be used?

str.toLowerCase().replaceAll(" ", "-")

@Lisandra-dev
Copy link
Member

The problem is that slugify also replace special text.
But I can make an option in slufigy to choose your methods to do so. I will do it later :)

@miaogaolin
Copy link
Author

Thanks a bunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants