Author Topic: Ability to specify script type -> syntax highlighters for embedded languages  (Read 2067 times)

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
The ability to specify script type -> syntax highlighters for embedded languages.

Code: [Select]
<script id="vertex-shader" type="foo-glsl">
void main()  {
  gl_Position = ...
}
</script>
<script>
window.onload = function()  {...
</script>

It's a common pattern. That first script tag should really have GLSL syntax highlighting and completion not JavaScript like the second

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
The ability to specify script type -> syntax highlighters for embedded languages.

Code: [Select]
<script id="vertex-shader" type="foo-glsl">
void main()  {
  gl_Position = ...
}
</script>
<script>
window.onload = function()  {...
</script>

It's a common
 pattern. That first script tag should really have GLSL syntax highlighting and completion not JavaScript like the second

I was trying to research what standards if any there are for specifying GLSL code in HTML. Googles produced very little info. I found:

<script id="2d-vertex-shader" type="x-shader/x-vertex">

and

<script type="x-shader/x-fragment" id="shader-fs" src="util/fs"></script>

You posted:

<script id="vertex-shader" type="foo-glsl">


It's really not obvious what the standard is here or if there is a standard for this.

Any help would be greatly appreciated.

greggman

  • Senior Community Member
  • Posts: 280
  • Hero Points: 14
The ability to specify script type -> syntax highlighters for embedded languages.

Code: [Select]
<script id="vertex-shader" type="foo-glsl">
void main()  {
  gl_Position = ...
}
</script>
<script>
window.onload = function()  {...
</script>

It's a common
 pattern. That first script tag should really have GLSL syntax highlighting and completion not JavaScript like the second

I was trying to research what standards if any there are for specifying GLSL code in HTML. Googles produced very little info. I found:

<script id="2d-vertex-shader" type="x-shader/x-vertex">

and

<script type="x-shader/x-fragment" id="shader-fs" src="util/fs"></script>

You posted:

<script id="vertex-shader" type="foo-glsl">


It's really not obvious what the standard is here or if there is a standard for this.

Any help would be greatly appreciated.

do you need a standard? Can you just let me assign a type string to a slickedit mode? That way I can put anything in a script tag and tell slickedit how I want it handled. That's actually why I used the "foo-glsl" example because I'm hoping it does not have to be limited it to select few you hard code.

For example I'm not sure how common this is but I've often put client side templates in script tags

Code: [Select]
<script id="buttontemplate" type="mytemplate">
  <div class="button"><a href="{{url}}" title="{{title}}" id="{{count}}-button" databaseid="{{id}}"><div><img src="{{buttonImgUrl}}" /></a></div>
</script>

Works great. I can grab that text with

Code: [Select]
var templateText = document.getElementById("buttonTemplate").text;
« Last Edit: October 11, 2015, 11:01:22 PM by greggman »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
No time to put in a completely new infrastructure. Making embedded languages completely configurable will have problems. Some languages can't be embedded in other languages due to design limits and/or performance problems. Hard wiring it at least allows us to make sure it works for that combination.
« Last Edit: October 12, 2015, 02:13:21 AM by Clark »