vue-syntax-highlight icon indicating copy to clipboard operation
vue-syntax-highlight copied to clipboard

add "text/x-template" as type

Open Drive4ik opened this issue 6 years ago • 3 comments
trafficstars

add "text/x-template" as type of script

<script type="x-template">

as suggested here https://vuejs.org/v2/api/#template

Drive4ik avatar Feb 15 '19 12:02 Drive4ik

This would be great for us who us the template option.

Does this also match just the shorthand <script type="x-template"> or only <script type="text/x-template">? I can't tell in the PR right away.

Wonder if a maintainer might look at this and consider merging? From a quick cursory glance other people are looking for Vue syntax highlighting of these templates on Stack Overflow and other forums.

dmyers avatar Apr 10 '19 19:04 dmyers

@dmyers I added missed x-template type. Now supports

<script type="x-template">

and

<script type="text/x-template">

Drive4ik avatar Sep 05 '19 10:09 Drive4ik

From reading up on it quickly, this seems not that relevant for an SFC .vue file, because the <script type="text/x-template"> syntax is supposed to be used in html files and thus would requre extending the default HTML syntax with one that recognizes this template syntax to then include the vue template syntax there. Additionally, you would have to use this extended syntax for your html files.

It can be done, but considering how using the x-templates feature is discouraged in the Vue 2 docs and I wasn't able to find a mention of it in the Vue 3 docs, I presume this is not all that relevant.

FichteFoll avatar Oct 27 '23 14:10 FichteFoll