async create()

in site/src/shortcodes/includecode/index.js [44:79]


  async create({ eap_github_path, current_github_path }) {    
    
    let eapCode = '';
    if(eap_github_path != undefined && eap_github_path !== '') {
      eapCode = await fetchCode(eap_github_path);
      eapCode = processSnippet(eapCode);
      eapCode = embedInCodeticks(eapCode);
      eapCode = md.render(eapCode);
      eapCode = eapCode.trim();
    }

    let currentCode = '';
    if(current_github_path != undefined && current_github_path !== '') {
      currentCode = await fetchCode(current_github_path);
      currentCode = processSnippet(currentCode);
      currentCode = embedInCodeticks(currentCode);
      currentCode = md.render(currentCode);
      eapCode = eapCode.trim();
    }
    const eapId = Math.random().toString(36).substring(7);
    const currentId = Math.random().toString(36).substring(7);
    return /*html*/`<eap-tab-switcher>
  <eap-tab-list role="tablist">
    <button aria-selected="true" id="aria-tab-${eapId}" data-panel="tabpanel-${eapId}" aria-controls="tabpanel-${eapId}">
      EAP Modular
    </button>
    <button id="aria-tab-${currentId}" data-panel="tabpanel-${currentId}" aria-controls="">
      v8 Current
    </button>
  </eap-tab-list>
  <eap-tab-panel-list>
    <eap-tab-panel id="tabpanel-${eapId}" aria-labelledby="aria-tab-${eapId}">${eapCode}</eap-tab-panel>
    <eap-tab-panel id="tabpanel-${currentId}" aria-labelledby="aria-tab-${currentId}" class="hidden">${currentCode}</eap-tab-panel>
  </eap-tab-panel-list>
</eap-tab-switcher>`;
  }