I ran into the problem that command buttons with alias {[Command|Alias]} do not render correctly inside markdown tables, while it works with page links [[Page|Alias]]
| Works? | Content | Example |
|--------|---------|---------|
| ✅ | Normal Link | [[index]] |
| ✅ | Alias Link | [[index|home]] |
| ✅ | Normal Command | {[System: Reload]}
| ❌ | Alias Command | {[System: Reload|Reload]}
Alias Command outside of table: {[System: Reload|Reload]} ✅
Escaping the Pipe is a cool trick, and the button is visible now, thanks!
But it does not end there for me:
On clicking the button (mouse on firefox), the button does not react, but the table goes to ‘edit mode’, showing the markdown. This is unrelated to the aliasing, but it would be good to have to buttons receive the click event and prevent the edit view
Second click on the button (in markdown) triggers an error:
"Error parsing command link arguments: Command Help: Version\ not found
Looks like the \ is not just escaping the | but is also added to the command name, which is consequently not found anymore.
As the works with pagelinks, my assumption is that it has to be a difference somewhere in the guts of markdown parsing. I took a brief look at that area of the code and it is lots of regexp, which is good at parsing, but hard to parse.
Update, I just got it to work with a very ugly hack: Just add the backslash to the name of the command as well (I want to use this in templates with Command in space-lua to set page attributes):
```template
| Page | Stars |
| ---- | ----- |
{{#each {page where stars>=0}}}
|{{name}}| {{stars}} {[Page: Set Attribute\|Add Star]({"attribute": "stars","change":1, "page":"{{name}}" })}|
{{/each}}
```
```space-lua
command.define {
name = "Page: Set Attribute\\",
run = function(a)
system.invoke_command("Page: Set Attribute",a)
end
}
```
Interesting workaround XD
Didn’t even know, that having buttons/commands in tables was possible, this opens up some cool new possibilities!
The retained backslash does look like a parsing issue, but I’m neither a regex expert nor good with javascript, so I’ll pass the task of improving this to someone else