问题
In my Ruby on Rails templates I write underscore templates within <script type='text/html'>
elements.
I'm using rails.vim and other plugins, but syntax highlighting and identation rules don't work for the htmls inside these elements.
回答1:
Put it in a partial. That also keeps the page with all the html scripts from growing into a monster.
<script type="text/x-underscore">
<%= render 'my_partial_with_syntax_highlighting' %>
</script>
Ditto for using something other than text/html for content type.
来源:https://stackoverflow.com/questions/17157519/syntax-highlight-javascript-templates-within-script-type-text-html-elements