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
642 stars 39 forks source link

[Bug]: TypeError: n is not iterable #245

Closed garethfoote closed 11 months ago

garethfoote commented 11 months ago

Issue validation

Command used

Refresh published and upload new notes

Plugin version

6.10.3

Describe the bug

Hi, I'm getting the following error in the console:

Uncaught (in promise) TypeError: n is not iterable

Here is the full error: Screenshot 2023-11-17 at 16 39 33

I've tested the connection and it's getting through to my repo fine.

Appreciate the great work done on this plugin btw. 🙏

How to reproduce ?

No response

Minimal Reproducible Example

Trying to upload this note for example: 

---
share: true
homepage: true
category: _writing
date: 2023-03-01
title: Designing a file browsing experience
topics: [Design, Accessibility]
types: [Case Study]
---

This is a case study explaining the context in which the Tree View component was designed and built, whilst working as a designer for The National Archives.

This is a case study explaining the context in which the Tree View component was designed and built, whilst working as a designer for The National Archives.

- [[Weeknote 01|different text that links to Weeknote 01]]
- [[Weeknote 02]]
- [[Mini-briefs - Exploring datasets]]
- [[Accessibility]]

![[Choose a file 1.png|alt text]]

Configuration

{
  "github": {
    "branch": "main",
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)"
    },
    "workflow": {
      "name": "",
      "commitMessage": "[PUBLISHER] Merge"
    },
    "verifiedRepo": true,
    "automaticallyMergePR": true
  },
  "upload": {
    "behavior": "yaml",
    "defaultName": "collections",
    "rootFolder": "collections",
    "yamlFolderKey": "category",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [
      {
        "type": "title"
      }
    ],
    "replacePath": [
      {
        "regex": "025-Sub-Brain",
        "replacement": "",
        "type": "path"
      }
    ],
    "autoclean": {
      "enable": false,
      "excluded": ""
    },
    "folderNote": {
      "enable": false
    }
  },
  "conversion": {
    "hardbreak": false,
    "censorText": [
      {
        "entry": "\\|",
        "replace": "@#",
        "after": false
      }
    ],
    "tags": {
      "inline": false,
      "exclude": [],
      "fields": []
    },
    "links": {
      "slugify": false
    }
  },
  "embed": {
    "forcePushAttachments": [],
    "attachments": true,
    "keySendFile": [],
    "notes": false,
    "folder": "attachments",
    "charConvert": "->",
    "convertEmbedToLinks": "keep"
  }
}

Relevant log output

No response

OS

MacOS

Anything else?

I'm doing something quite unusual with the text replacer. Could be something to do with that?

Screenshot 2023-11-17 at 16 45 43

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.4.16
    Installer version: v1.4.16
    Operating system: Darwin Kernel Version 20.6.0: Tue Jun 21 20:50:28 PDT 2022; root:xnu-7195.141.32~1/RELEASE_X86_64 20.6.0
    Login status: logged in
    Catalyst license: none
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: light
    Community theme: Minimal v7.2.1
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 19
    Plugins enabled: 15
        1: Advanced Tables v0.19.1
        2: Better Word Count v0.10.0
        3: Calendar v1.5.10
        4: Contextual Typography v2.2.5
        5: Hotkeys for Bookmarks v1.1.0
        6: Hotkeys++ v0.2.7
        7: Minimal Theme Settings v7.3.0
        8: Tasks v5.0.0
        9: Style Settings v1.0.7
        10: Github Publisher v6.10.3
        11: Natural Language Dates v0.6.1
        12: Auto Link Title v1.4.1
        13: Dataview v0.5.64
        14: Image Converter v1.1.7
        15: Lapel v0.1.1

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 11 months ago

First, thanks for the great reproduction example!

I need to some help to get throught. I think (not tested for the moment!) you have a good catch with the regex. But… I can't read it in the screen 😢 Could you please send me it in text form ? Thanks!

EDIT: Found the problem 🎉 Fixed in 6.11.0

garethfoote commented 11 months ago

Thank you, @Lisandra-dev. That was fast!

Seems that my unusual requirement of using the text replacer inside the wikilinks is causing some pretty niche behaviour.

I'm doing some post-processing of the MD files once they get to my repo in Jekyll templates. This is to provide different text for an anchor than the file title and to provide alt text for an image. That means I need the wikilinks to reach my repo with a custom demarcating symbol instead of a pipe (because Jekyll immediately converts pipes to tables).

So, I'm using the text replacer to make this: [[Weeknote 01|different text linking to Weeknote 01]]
arrive in my repo as: [[Weeknote 01@@different text linking to Weeknote 01]]

but it is arriving like this:
[[Weeknote 01@@different text linking to Weeknote 01|Weeknote 01@@different text linking to Weeknote 01]] (See this PR.)

I assume the recent automatic addition of alt text can't be disabled in the config anywhere?

PS Should I create a new issue for this? PPS I understand if this is outside of the remit of the plugin.

Mara-Li commented 11 months ago

Think you can use the text replacer with the arrow to down to use the replacer after all transform

garethfoote commented 11 months ago

Amazing! That did it. Many thanks @Lisandra-dev