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

[Plugin][FR]: Support Inline dataview #184

Closed mclearc closed 1 year ago

mclearc commented 1 year ago

Issue validation

Command used

Refresh published and upload new notes

Plugin version

6.3.2

Describe the bug

I have files in which I use simple inline dataview queries (e.g. =this.name). However these do not render (see example file).

How to reproduce ?

No response

Minimal Reproducible Example


share: true date created: Thursday, July 27th 2023, 7:41:20 am date modified: Friday, July 28th 2023, 8:37:51 am whichParty: Party 1 tags:

[!infobox]

=this.file.name (=this.pronouns)

Pronounced: "=this.pronounced" ![[blerg.png|cover hm-sm]]

Bio
Age =this.age
Sex =this.gender
Sexuality =this.sexuality
Occupation(s) =this.occupation
Group(s) =link(this.associatedGroup)
Religion(s) =link(this.associatedReligion)
Alias(es) =this.alias
Current Location =link(this.location)

=this.file.name

[!info|bg-c-purple]- Overview Blurg is a plasmoid with a mysterious past.

[!column|clean no-title] Traits

[!metadata|text-Center bg-c-blue]+ Traits =this.traits

[!metadata|text-Center bg-c-blue]+ Goals =this.goals

Stats & Info

[!column|clean no-title] Stats

[!info|text-Center bg-c-yellow]+ Ability Scores

Ability Score Mod
Strength =this.strength = round(sum(this.strength - 10) / 2)
Dexterity =this.dexterity = round(sum(this.dexterity - 10) / 2)
Constitution =this.constitution = round(sum(this.constitution - 10) / 2)
Intelligence =this.intelligence = round(sum(this.intelligence - 10) / 2)
Wisdom =this.wisdom = round(sum(this.wisdom - 10) / 2)
Charisma =this.charisma = round(sum(this.charisma - 10) / 2)

[!info|text-Center bg-c-yellow]+ Other Info

  • Ancestry: =this.ancestry
  • Background: =this.background
  • Class: =this.class
  • Level: =this.level
  • Alignment: =this.alignment
  • Condition: =this.condition
  • Hit Dice: =this.hd
  • AC: =this.ac
  • Speed: =this.speed
  • Initiative: + = round(sum(this.dexterity - 10) / 2)

Relationships

[!column|dataview|clean no-title] Acquaintances

[!metadata|text-Center bg-c-green]- Friends & Family None known

[!metadata|text-Center bg-c-red]- Rivals TBD

Biographical Details

TBD

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": true,
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "obsidian",
    "defaultName": "docs",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "enable": true,
      "excluded": [
        "docs/assets/js",
        "docs/assets/meta",
        "docs/assets/css",
        "tags.md",
        "graph.md"
      ]
    },
    "folderNote": {
      "enable": true,
      "rename": "index.md"
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": false,
    "dataview": true,
    "censorText": [],
    "tags": {
      "inline": false,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": true,
      "unshared": false,
      "wiki": false,
      "slugify": false
    }
  },
  "embed": {
    "attachments": true,
    "keySendFile": [],
    "notes": false,
    "folder": "docs/assets/img"
  }
}

Relevant log output

No response

OS

No response

Anything else?

You can see the errored output here:

Screenshot 2023-07-28 at 10 44 45

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.3.5
    Installer version: v1.1.16
    Operating system: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 22.5.0
    Login status: not logged in
    Insider build toggle: off
    Live preview: off
    Legacy editor: off
    Base theme: adapt to system
    Community theme: Ebullientworks v0.7.11
    Snippets enabled: 11
    Restricted mode: off
    Plugins installed: 53
    Plugins enabled: 51
        1: Style Settings v1.0.6
        2: Banners v1.3.3
        3: Auto Note Mover v1.2.0
        4: Admonition v9.3.3
        5: Advanced Tables v0.19.1
        6: Dataview v0.5.56
        7: Dice Roller v9.3.0
        8: Excel to Markdown Table v0.4.0
        9: Icons v0.3.0
        10: Image Toolkit v1.3.1
        11: Initiative Tracker v11.2.0
        12: Kanban v1.5.3
        13: Media Extended v2.11.1
        14: Obsidian Leaflet v5.7.2
        15: Pane Relief v0.5.1
        16: Table Extended v1.6.1
        17: Text Format v2.2.1
        18: Timelines v0.3.2
        19: Second Window v1.0.6
        20: Various Complements v8.3.2
        21: JSON/CSV Importer v0.30.0
        22: Templater v1.16.0
        23: DB Folder v3.4.0
        24: Org Mode v1.3.3
        25: Annotator v0.2.10
        26: Webpage HTML Export v1.6.0
        27: Buttons v0.4.19
        28: Text Generator v0.3.20
        29: Icon Folder v2.1.2
        30: Fantasy Content Generator v1.2.2
        31: Force note view mode v1.2.0
        32: Hover External Link Plugin v1.0.0
        33: Fantasy Statblocks v3.6.7
        34: Linter v1.17.0
        35: Breadcrumbs v3.6.4
        36: Note Auto Creator v1.4.0
        37: Link with alias v1.0.6
        38: Github Publisher v6.3.2
        39: Custom Frames v2.4.6
        40: Settings Search v1.3.8
        41: Obsidian42 - BRAT v0.7.0
        42: Text Mapper v1.0.0
        43: Export Image plugin v1.0.3
        44: Mousewheel Image zoom v1.0.19
        45: Fantasy name generator v0.0.2
        46: Quick Switcher++ v3.3.4
        47: Better Word Count v0.10.0
        48: Excalidraw v1.9.12
        49: Multi-Column Markdown v0.8.3
        50: Hover Editor v0.11.13
        51: Folder notes v1.4.4

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 1 year ago

It was not a bug, but the function was made before the API can support converting DJS, inline etc.

But, now It can, as I checked the code of @oleeskild

https://github.com/oleeskild/obsidian-digital-garden/blob/4cdf2791e24b2a0c2a30e7d39965b7b9b50e2ab0/src/Publisher.ts#L297C1-L388

mclearc commented 1 year ago

Is there something I can do on my end or does the package code just need to be updated?

Mara-Li commented 1 year ago

I updated quickly a beta update to try if everything is good! I need to make some test before make it production. You can update with BRAT!

mclearc commented 1 year ago

@Lisandra-dev Thanks for moving so quickly with this. I can attest that things are improved but I've noticed that inline dataview that is in a callout doesn't work (see screenshot). Is this expected?

Screenshot 2023-07-28 at 15 11 33
Mara-Li commented 1 year ago

Maybe it's the table? They seems to have be wrongly formatted... I need to check

mclearc commented 1 year ago

Here's a copy of that file (though the above one works too) if it helps...

---
share: true
date created: Thursday, July 27th 2023, 7:41:20 am
date modified: Friday, July 28th 2023, 8:37:51 am
whichParty: Party 1
tags:
  - ermis
  - party
  - pc
ancestry: Plasmoid
gender: N/A
sexuality: Asexual
pronouns: They/Them
condition: Healthy
aliases:
  - "**`=this.file.name`**"
type: pc
name: Blurg
class: Wizard
subclass: null
level: 2
background: Feylost
strength: 13
dexterity: 16
constitution: 14
intelligence: 19
wisdom: 13
charisma: 10
hd: 1d6
ac: "12"
speed: 30
alignment: null
occupation: null
associatedGroup: null
associatedReligion: null
location: null
traits:
  - Weird
  - Supercillious
  - Inquisitive
goals: Learn the news about Ooze
linter-yaml-title-alias: "**`=this.file.name`**"
art: "![[blerg.png]]"
---

> [!infobox]
> # `=this.file.name` (`=this.pronouns`)
> **Pronounced:**  "`=this.pronounced`"
> ![[blerg.png|cover hm-sm]]
> ###### Bio
>  |
> ---|---|
> **Age** | `=this.age` |
> **Sex** | `=this.gender` |
> **Sexuality** | `=this.sexuality` |
> **Occupation(s)** | `=this.occupation` |
> **Group(s)** | `=link(this.associatedGroup)` |
> **Religion(s)** | `=link(this.associatedReligion)` |
> **Alias(es)** | `=this.alias` |
> **Current Location** | `=link(this.location)` |

# **`=this.file.name`**
> [!info|bg-c-purple]- Overview
> Blurg is a plasmoid with a mysterious past.

> [!column|clean no-title] Traits
> > [!metadata|text-Center bg-c-blue]+ Traits
> > `=this.traits`
> 
> > [!metadata|text-Center bg-c-blue]+ Goals
> > `=this.goals`

## Stats & Info
> [!column|clean no-title] Stats
> > [!info|text-Center bg-c-yellow]+ Ability Scores
> > 
>  > | Ability      | Score                | Mod                                        |
>  > |--------------|----------------------|--------------------------------------------|
>  > | Strength     | `=this.strength`     | `= round(sum(this.strength - 10) / 2)`     |
>  > | Dexterity    | `=this.dexterity`    | `= round(sum(this.dexterity - 10) / 2)`    |
>  > | Constitution | `=this.constitution` | `= round(sum(this.constitution - 10) / 2)` |
>  > | Intelligence | `=this.intelligence` | `= round(sum(this.intelligence - 10) / 2)` |
>  > | Wisdom       | `=this.wisdom`       | `= round(sum(this.wisdom - 10) / 2)`       |
>  > | Charisma     | `=this.charisma`     | `= round(sum(this.charisma - 10) / 2)`     |
> 
> > [!info|text-Center bg-c-yellow]+ Other Info
> > - **Ancestry:**  `=this.ancestry`
> > - **Background:** `=this.background`
> > - **Class:** `=this.class`
> > - **Level:** `=this.level`
> > - **Alignment:** `=this.alignment`
> > - **Condition:** `=this.condition`
> > - **Hit Dice:** `=this.hd`
> > - **AC:** `=this.ac`
> > - **Speed:** `=this.speed`
> > - **Initiative:** \+ `= round(sum(this.dexterity - 10) / 2)`

## Relationships
> [!column|dataview|clean no-title] Acquaintances
> > [!metadata|text-Center bg-c-green]- Friends & Family
> > None known
> 
> > [!metadata|text-Center bg-c-red]- Rivals
> > TBD
>

## Biographical Details

TBD
mclearc commented 1 year ago

And this is how it looks in obsidian...

Screenshot 2023-07-28 at 15 20 12
Mara-Li commented 1 year ago

Work on my side image

Mara-Li commented 1 year ago

BTW, for the blog, you need to have >> instead of > > !

I have a linter function for this if you need.

Btw I can repro your issue, but don't understand why it does that when in a multiple callout. Will work on it!

mclearc commented 1 year ago

Thank you! -- I'll experiment as well. I use obsidian linter so I'd love to add your linter function as a custom command! :)

Mara-Li commented 1 year ago

Okay, found the problem. If their is no result (rendered as "-" if null) the code leave it as it! I will update to use the rendering settings of Dataview :)

Mara-Li commented 1 year ago

Fixed in the last beta !

mclearc commented 1 year ago

I'm sorry to bother about this again but I keep seeing this error:

Screenshot 2023-07-28 at 17 16 35

I've tried several different permutations though none work. Here's the code again.

And I've updated via BRAT so I should be on the most recent version. Again, appologies for the bother.

>[!infobox]
># `=this.file.name` (`=this.pronouns`)
>**Pronounced:**  "`=this.pronounced`"
>![[blurg.png|cover hm-sm]]
> ###### Bio
>  |
>---|---|
>| **Age**              | `=this.age`                      |
>| **Sex**              | `=this.gender`                   |
>| **Sexuality**        | `=this.sexuality`                |
>| **Occupation(s)**    | `=this.occupation`               |
>| **Group(s)**         | `=link(this.associatedGroup)`    |
>| **Religion(s)**      | `=link(this.associatedReligion)` |
>| **Alias(es)**        | `=this.alias`                    |
>| **Current Location** | `=link(this.location)`           |
Mara-Li commented 1 year ago

Yeah, your table is not goodly formatted for mkdocs. You need:

mclearc commented 1 year ago

Amazing -- all the permutations I tried and not the right one :/

Thanks so much for all your help today! Amazing work!!