JupyterLab custom extension where if i click on button or link to existing notebooks in voila preview should open in split tab to the right

New to jupyter lab extensions, any suggestions/working code that can be added to index.ts is really appreciated
I want to create a custom extension where if any link/button to notebooks in voila preview is clicked it should open the notebook in voila preview in split tab within jupyterlab.
Lets say i have a small code in jupyter notebook cell

from IPython.display import display, HTML

# Create an HTML link that opens the notebook in Voilà preview
html_link = """
<a href="untitled1.ipynb" >Open other notebook with Voilà</a>
"""
display(HTML(html_link))

The way on clicking “Render with voila” toolbar button it splits the window into two the same way if i click on the notebook link it should provide rendered view split to the right


Right now by default it renders with voila in new browser tab altogether but i want to split to right within jupyter lab

I have posted here as well

You may want to use command linker by adding data-commandLinker-command attribute on the link, see the example in:

https://jupyterlab.readthedocs.io/en/stable/user/commands.html#commands-in-markdown-files

You would need to find out what is the viola command called and what arguments it takes

If you have a custom extension you can add a custom command there and link it with the button via command linker.

@krassowski Thank you for responding.Yes, I would like to create a custom extension but don’t have one created yet.
Can you please give a little more detail on your suggestion perhaps a rough code to give me a clearer picture. That would be really helpful.