Enveloppe / obsidian-enveloppe

Enveloppe helps you to publish your notes on a GitHub repository from your Obsidian Vault, for free!
https://enveloppe.github.io/
Apache License 2.0
636 stars 39 forks source link

[Bug]: Folder Path & File Name Replacer doesn't work on dataview content #322

Closed bluerosegarden closed 7 months ago

bluerosegarden commented 7 months ago

Issue validation

Command used

Upload all notes

Plugin version

7.0.3-4

Describe the bug

I have a simple folder-path replacement that just removes the top-level folder path when pushed, and this works as expected for both the site's structure and links. However, if you use a dataview block that links a file the folder-path replacement leaves it untouched. I would have to assume folder-path replacement runs once before the dataview block is converted into markdown, so it remains untouched.

How to reproduce ?

  1. Create a few different files.
  2. Have dataview return a list of links to those files (such as using LIST or TABLE)
  3. hard-code links to some of those files
  4. Use the file-path and filename replacement settings to edit either specific files or (in my case anyways) file paths.
  5. Run the plugin, and the hard-coded links will be edited appropriately while the dataview-block will be unedited

Minimal Reproducible Example

Create three files:
File 1.md

#dataview-tag
This is file 1

File 2.md

#dataview-tag
This is file 2

File 3.md

This is file 3
```dataview
LIST FROM #dataview-tag

[[File 1]] [[File 2]]


### Configuration

```JSON
{
  "github": {
    "branch": "live",
    "automaticallyMergePR": true,
    "dryRun": {
      "enable": false,
      "folderName": "__Test\\{repo}\\github-publisher"
    },
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "obsidian",
    "defaultName": "content",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": true,
      "key": "slug"
    },
    "replaceTitle": [],
    "replacePath": [
      {
        "regex": "✿Learning",
        "replacement": "Learning",
        "type": "path"
      },
      {
        "regex": "❀Code",
        "replacement": "Code",
        "type": "path"
      },
      {
        "regex": "§Attachments",
        "replacement": "attachments",
        "type": "path"
      },
      {
        "regex": "Ash In the Snow",
        "replacement": "",
        "type": "path"
      }
    ],
    "autoclean": {
      "enable": true,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md",
      "addTitle": {
        "enable": false,
        "key": "title"
      }
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": true,
    "dataview": true,
    "censorText": [
      {
        "entry": "/[dD][Mm] [Ss]creen\\n---\\s*\\n*[^]+$/gm",
        "replace": " ",
        "flags": "",
        "after": false
      }
    ],
    "tags": {
      "inline": false,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": false,
      "unshared": false,
      "wiki": false,
      "slugify": false
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [
      {
        "path": "§Attachments",
        "destination": "attachments",
        "forcePush": true
      }
    ],
    "keySendFile": [],
    "notes": false,
    "folder": "",
    "convertEmbedToLinks": "keep",
    "charConvert": "->",
    "forcePushAttachments": [],
    "useObsidianFolder": true
  },
  "plugin": {
    "shareKey": "publish",
    "excludedFolder": [],
    "copyLink": {
      "enable": true,
      "links": "<edited out>",
      "removePart": [
        "/content/",
        ".md"
      ],
      "transform": {
        "toUri": true,
        "slugify": "lower",
        "applyRegex": []
      }
    },
    "setFrontmatterKey": "Set"
  }
}

Relevant log output

No response

OS

Windows

Anything else?

This is on a secondary repository as well, but I don't think that quite matters here.

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.5.10
    Installer version: v1.4.13
    Operating system: Windows 10 Home 10.0.22631
    Login status: logged in
    Catalyst license: insider
    Insider build toggle: on
    Live preview: on
    Base theme: light
    Community theme: none
    Snippets enabled: 6
    Restricted mode: off
    Plugins installed: 94
    Plugins enabled: 87
        1: Charts View v1.2.7
        2: Divide & Conquer v1.0.0
        3: Minimal Theme Settings v7.3.1
        4: Calendar v1.5.10
        5: Buttons v0.5.1
        6: Canvas Links v1.1.4
        7: Annotator v0.2.11
        8: April's Automatic Timelines v0.13.2
        9: Archiver v0.26.1
        10: Crossbow v1.4.0
        11: Contextual Typography v2.2.5
        12: Commander v0.5.1
        13: Colorful Note Borders v0.2.4
        14: Chem v0.3.0
        15: Advanced Tables v0.21.0
        16: Colored Tags v5.0.0
        17: Color Palette v2.2.0
        18: Badges v1.1.0
        19: Set Mobile Theme v0.2.0
        20: Codename v1.0.0
        21: Admonition v10.2.0
        22: Time Ruler v2.2.0
        23: Templater v2.2.1
        24: TagFolder v0.18.5
        25: Table Extended v1.6.1
        26: Supercharged Links v0.11.1
        27: Style Settings v1.0.7
        28: Sortable v0.3.1
        29: Soomda v1.0.4
        30: Solve v0.9.0
        31: Shukuchi v0.4.1
        32: Settings Search v1.3.10
        33: QuickAdd v1.7.0
        34: Reading View Enhancer v0.1.4
        35: Quick Switcher++ v4.0.0
        36: Projects v1.17.1
        37: Plugin Manager v0.1.5
        38: Periodic Notes v0.0.17
        39: Outliner v4.8.0
        40: BRAT v0.8.4
        41: Math+ v0.7.0
        42: Mood Tracker v1.2.1
        43: MetaEdit v1.8.2
        44: Lovely-Mindmap v1.0.1
        45: Linter v1.22.0
        46: Leader Hotkeys v0.2.1
        47: Latex Environments v0.4.2
        48: Kanban v1.5.3
        49: Juggl v1.5.0
        50: Improved VimCursor v0.0.1
        51: ICS v1.6.1
        52: JS Engine v0.1.2
        53: Homepage v3.7.0
        54: Heatmap Calendar v0.6.0
        55: Habit Calendar v1.2.0
        56: Find orphaned files and broken links v1.9.1
        57: Full Calendar v0.10.7
        58: Force note view mode v1.2.2
        59: Folder notes v1.7.14
        60: File Diff v1.1.1
        61: File Color v1.1.0
        62: Email code block v0.6.0
        63: Desmos v0.6.6
        64: Dataview v0.5.64
        65: Data Entry v9.0.1
        66: Footnote Shortcut v0.1.3
        67: Colored Text v1.0.0
        68: @ Symbol Linking v1.6.2
        69: Markdown Table Editor v0.3.1
        70: Breadcrumbs v3.6.11
        71: Github Publisher v7.0.3-4
        72: Meta Bind v0.12.5
        73: Emoji Magic v0.2.2
        74: Iconize v2.10.1
        75: File Explorer++ v1.1.4
        76: Typing v0.3.7
        77: Object Writer v1.0.0
        78: Ribbon Divider v1.0.0
        79: Pomodoro Timer v1.1.9
        80: Tasks v6.0.0
        81: File Property Enhancer v1.1.1
        82: Multi Properties v1.0.0
        83: Dice Roller v10.4.5
        84: Rant-Lang v0.5.9
        85: Trash Explorer v1.2.2
        86: Excalidraw v2.0.22
        87: ExcaliBrain v0.2.14

RECOMMENDATIONS:
    Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Mara-Li commented 7 months ago

I'm pretty sure it worked in previous version. What I have done (again)

EDIT: The path of unshared note is not converted in your setup. Are the note listed in Dataview shared?

bluerosegarden commented 7 months ago

I'm pretty sure it worked in previous version. What I have done (again)

EDIT: The path of unshared note is not converted in your setup. Are the note listed in Dataview shared?

Yep they're shared! I can navigate to them just fine if i hard-link them or in the side-bar, but just not the dataview block (thanks for the fast reply btw omg)

Mara-Li commented 7 months ago

Okay, will check that and return here after some test and fix