Problem

When loading TEI/XML files and visualizing them with JavaScript (such as Vue.js), there were cases where unintended whitespace was inserted.

Specifically, when writing HTML like the following:

<t/e<tmd/epi<dmlvaipa>vlth>aert>eef>="#"></a>

It was displayed as shown below, with unintended spaces inserted: “お問い合わせは こちらから お願いします”.

A solution for this issue was published in the following repository.

https://github.com/aokiken/vue-remove-whitespace

However, I was unable to get it working properly with Nuxt 3 in my environment, so I referenced the source code and introduced it into Nuxt 3.

Below is a note on this process.

Introduction to Nuxt 3

Create plugins/removeWhitespace.ts.

f}f}e}uux)nnpn};ccou)trtA}rxm}u};ieir)tto,p,otorAutdtnunadpnrarryi}teptitiint.frf.ememsrfiavdTdTTnir(muu(e(eeomoinrTleexexxdTmsoeetAltlttee(Tdtxp:(:((.xneeutdpeenntox.r(e.HlHloo(dttnnfdT.T.ddne(eoiiMcMceeo)nxdnrLhLh:Td.oteeeEiEiyefdC.NcllllCp:oeocutededher)nhximNmNiNEtitveoeol=oa&elPendndd=dc&ndl(teteN=ehtNu")s)soL(nogr))dNi(o=die{{eosndenm)dtoens(oeOd.o)(v{.fetdneT<)eeuWECx.xhXh=tttiTi>CeAt_loxpeNd{ntpsONtC)pDoeoaEdnn=cett>e>)e")n{,{t{.{trim()

Then, use the v-remove-whitespace directive in pages/index.vue, etc.

<t/e<tmd/epi<dmlvaipavlth>ae-rt>reeef>m=o"v#e"->whites<p/aac>e>

As a result, the unintended whitespace was successfully removed.

Summary

My understanding of directives may be incomplete, and there may be errors, but I hope this serves as a useful reference.

Below are the source code and demo site (GitHub Pages).

Source Code

https://github.com/nakamura196/nuxt3-removeWhitespace

Demo Site

https://nakamura196.github.io/nuxt3-removeWhitespace/

As a side note, by writing nuxt.config.ts as follows, I was able to specify the baseURL.

e}x)pa};op,rpbt:asd{eeUfRaLu:lt"/dneufxitn3e-NruexmtoCvoenWfhiigt(e{space",<reponame>

I hope this serves as a useful reference for publishing Nuxt 3 SSG on GitHub Pages.