NicoNekoru / obsidan-advanced-table-xt

Plugin that adds features to tables in obsidian including merging, vertical headers, and custom css
Apache License 2.0
98 stars 5 forks source link

Copying examples to notes, error #20

Closed zhoulonghao520 closed 1 year ago

zhoulonghao520 commented 1 year ago

{
    classes: {
        c1: {
            "color": "cyan",
        },
        c2: {
            backgroundColor: "#555",
        }
    },
}

--- ~ { color: 'red' }

| I           | ----   | have     | meta                  | data        | too! |
| ------------| ------ | -: ~ .c2 | --------------------- | ----------- | ---- |
| group 1     | ----   | ~~foo~~  | bar ~ .c1 .c2         | $baz$       | test |
| group 2     | - ~.c1 | 1\. test | ^                     | 3 ~ .c2     | 4    |

image

Copying examples to notes, error. I don't know why

zhoulonghao520 commented 1 year ago

{classes:{c1:{"color":"cyan",},c2:{backgroundColor:"#555",}},}
--- 

| I           | ----   | have     | meta                  | data        | too! |
| ------------| ------ |------| --------------------- | ----------- | ---- |
| group 1     | ----   | ~~foo~~  | bar ~ .c1 .c2         | $baz$       | test |
| group 2     | - ~.c1 | 1\. test | ^                     | 3 ~ .c2     | 4    |

image

It should be a space symbol issue

abiriadev commented 1 year ago

@zhoulonghao520 I think you have many non-breaking spaces in your code

$ cat -v ws.md
{
M-BM-  M-BM-  classes: {
M-BM-  M-BM-  M-BM-  M-BM-  c1: {
M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  "color": "cyan",
M-BM-  M-BM-  M-BM-  M-BM-  },
M-BM-  M-BM-  M-BM-  M-BM-  c2: {
M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  backgroundColor: "#555",
M-BM-  M-BM-  M-BM-  M-BM-  }
M-BM-  M-BM-  },
}

--- ~ { color: 'red' }

| I M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  | ---- M-BM-  | have     | meta M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM- | data M-BM-  M-BM-  M-BM-  M-BM- | too! |
| ------------| ------ | -: ~ .c2 | --------------------- | ----------- | ---- |
| group 1 M-BM-  M-BM-  | ---- M-BM-  | ~~foo~~  | bar ~ .c1 .c2         | $baz$ M-BM-  M-BM-  M-BM-  | test |
| group 2     | - ~.c1 | 1\. test | ^ M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  M-BM-  | 3 ~ .c2     | 4 M-BM-  M-BM- |

By removing these non-breaking spaces, it will work as expected.

$ sed -i 's/\xC2\xA0//g' ws.md
$ cat -v ws.md

{
  classes: {
    c1: {
      "color": "cyan",
    },
    c2: {
      backgroundColor: "#555",
    }
  },
}

--- ~ { color: 'red' }

| I      | ----  | have     | meta         | data    | too! |
| ------------| ------ | -: ~ .c2 | --------------------- | ----------- | ---- |
| group 1   | ----  | ~~foo~~  | bar ~ .c1 .c2         | $baz$    | test |
| group 2     | - ~.c1 | 1\. test | ^           | 3 ~ .c2     | 4  |

image

This is probably your IME issue, I think.

Although supporting whitespaces is probably a good idea, JSON does not allow unicode whitespace at the syntax level (as far as I know).