Pass data TO content script

I'm looking for doing MarkdownIt version of automatic Backlinks to notes - backlinks plugin (instead of manually like its now).

function plugin(md, _options) {
    console.log(_options)
    

    function render_footnote_block_open2(tokens, idx, options) {

        return `<div id="backref">back</div><a href="#" onclick="let cont='asdf';async function a(){cont=await webviewApi.executeCommand('getCont');webviewApi.executeCommand('getCont').then(res=>console.log(res));document.getElementById('backref').innerHTML=cont};a();">asdf</a>`
    //return `<div id="backref">back</div><a href="#" onclick="document.getElementById('backref').innerHTML='test manual';">asdf</a>`
        
      }
      

    md.renderer.rules.footnote_block_open2   = render_footnote_block_open2;
    

    function footnote_tail2(state) {
 

        token = new state.Token('footnote_block_open2', '', 1);
        state.tokens.push(token);
  }
  md.core.ruler.after('inline', 'footnote_tail2', footnote_tail2);
		await joplin.commands.register({
			name: 'getCont',
			label: 'returns backlinks html',
			execute: async () => {
				console.log("called getCont()");

                // Here i would create HTML and pass it to markdown
				return "<b> testing html from command</b>"
			},
		});

Its possible to do it with panel view instead of Markdown plugin,
but that would clutter user interface.
Just thinking out loud but maybe ContentScript could have access to joplin.data methods?