Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "pipeReplacer" and "prefixCellValues" options to table entries. #46

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

skleinjung
Copy link
Contributor

pipeReplacer: This option supports use cases that require a different mechanism for escaping pipes within tables. For example, including an Obsidian link with a display name requires escaping with a slash (i.e. "|") instead of using an HTML entity.

prefixCellValues: The default table rendering is to include the "prefix" string before the value in every table cell, in addition to prefixing each individual table row. This option allows this behavior to be disabled, so that cell values are not prefixed. (It is possible the default behavior is a bug, but by providing a flag to change it this PR maintains backwards compatibility.)


Combined, these options allow me to use the default table entry to render ITS Theme infoboxes which contain fully-functional Obsidian links. An example of the type of output I want (which is a table embedded in a blockquote) is:

> [!infobox|wikipedia no-table-header center wm-sm static]
> 
> # 5th Month of the Year
> 
> ###### woopieo
> 
> | abc       | def                                                         |
> | --------- | ----------------------------------------------------------- |
> | Season    | [[Database/Calendar/seasons/Spring.md\|Mid Spring]]         |
> | Length    | 29 days                                                     |
> | Wysendays | - Smithing                                                  |
> | Moon Sign | [[Database/Calendar/moon signs/Knight's Moon.md\|Knight's]] |
> | New On    | 5th day                                                     |
> | Full On   | 19th day                                                    |
> 
> ###### Boopio
> 
> | abc         | def                                                |
> | ----------- | -------------------------------------------------- |
> | Preceded by | [[Database/Calendar/months/Symswald.md\|Symswald]] |
> | Followed by | [[Database/Calendar/months/Iggwyld.md\|Iggwyld]]   |

pipeReplacer: This option supports use cases that require a different mechanism for
escaping pipes within tables. For example, including an Obsidian link with a display
name requires escaping with a slash (i.e. "\|") instead of using an HTML entity.

prefixCellValues: The default table rendering is to include the "prefix" string before
the value in every table cell, in addition to prefixing each individual table row. This
option allows this behavior to be disabled, so that cell values are not prefixed. (It
is possible the default behavior is a bug, but by providing a flag to change it this PR
maintains backwards compatibility.)
@skleinjung
Copy link
Contributor Author

skleinjung commented May 29, 2024

These are the changes I'm running with locally to meet my requirements. I figured I would submit a PR to start a conversation on incorporating some version of these capabilities upstream. I'm definitely open to more holistic approaches if you have a better plan than just adding new options like this.

@kgar
Copy link
Owner

kgar commented May 31, 2024

This is awesome. I'll dig into this soon and try to get it pushed through and released.
Thank you for contributing!

@kgar kgar merged commit 5029ac9 into kgar:main Jun 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants