Skip to main content

Hello,

I've been using a very hacky method of generating a Markdown table using a formula in my base. The below example uses Markdown in quotes for the table structure, and then pulls from field data to populate the table.

Example:

 

" # DIVINATION " & "\n" & " | Divination | Result | Description | " & "\n" & " |-|-|-| " & "\n" & " | " & " Soothsayer's Deck " & " | " & {Soothsayer's Deck} & " | " & {Soothsayer's Deck Description} & " | " & "\n" & " | " & " Constellation " & " | " & {Constellation} & " | " & {Constellation Description} & " | " & "\n" & " | " & " Position " & " | " & {Position} & " | " & {Position Description} & " | " & "\n" & " | " & " Moon Phase " & " | " & {Moon Phase} & " | "

 

I then use an automation to populate a "Calculation Output" field using an example from @kuovonne in this thread.

The result outputs:

 

| Divination | Result | Description |

|-|-|-|

| Soothsayer's Deck | The Yoke | Burdens shared or intensified. Collaboration or hardship. |

| Constellation | The Key | (choice / power) |

| Position | Ethereal | (delicate / insubstantial) |

| Moon Phase | Waxing Gibbous |

 

I can then paste this into Obsidian to create a table.


I have two issues currently:

1. It results in a Markdown output with a line break on each line. This is because I need to use "\n" or the resulting Markdown will output like this:

 

| Divination | Result | Description | |-|-|-| | Soothsayer's Deck | The Yoke | Burdens shared or intensified. Collaboration or hardship. | | Constellation | The Key | (choice / power) | | Position | Ethereal | (delicate / insubstantial) | | Moon Phase | Waxing Gibbous |

 

This is no use for me as when I paste it into Obsdian, it doesn't generate the table without me individually pressing enter to create a new line. This is unwieldy because...

2. This is just a small example - the actual base has over 100 fields and 36 rows so the resulting code is unwieldy. I separate the calculations by title (General, Fate etc.)

Is there a simpler method to achieve this output?

Here's an example base with a portion of the records if you'd like to dig around: Base 

Any help appreciated. Thank you.

Be the first to reply!

Reply