Repository navigation
fix(prism): highlight scss, vue directives and vue typescript - #4873
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
806870c to
b23aa33
Compare
brandyscarney
left a comment
There was a problem hiding this comment.
Looks good! Nice improvement!
| 'inside', | ||
| 'attr-name', | ||
| { | ||
| directive: { |
There was a problem hiding this comment.
Since the bottom of this file sets Prism.languages.html = Prism.languages.markup = Prism.languages.vue, this rule also runs on every ```html block, not just ```vue. In practice, Angular template refs will now be colored as keywords:
docs/developing/managing-focus.mdx:187:<ion-input #input>docs/angular/quickstart.mdx:315:<ion-content [fullscreen]="true" #content>docs/angular/zoneless.mdx:113:<ion-popover #popover>
That's arguably an improvement, since template refs are framework syntax, but it's a visible change on Angular pages. Could you mention it in the description? If it's unwanted, the rule could go on a separate grammar for vue that html doesn't alias.
There was a problem hiding this comment.
Good catch, added to the description. I kept it shared: 7 of the 10 html blocks it matches are Vue code, including the Vue Navigation sample in How to test, so a Vue-only grammar would drop their directive colors until they're converted to vue blocks. The zoneless one is unaffected, since that template is a string inside a ts block.
b23aa33 to
3c35864
Compare
3c35864 to
f8ccb9c
Compare
f8ccb9c to
50e8294
Compare
50e8294 to
e4e58d9
Compare
Issue URL: N/A
What is the current behavior?
scss, so the 6 pages with```scssblocks show them as plain text: Theming Advanced, High Contrast Mode, and Angular Virtual Scroll, in docs and v8.v-if,:prop,@click) never runs, because the tag rule consumes attributes first, so directives look like plain attributes.<script setup lang="ts">blocks are highlighted as JavaScript, so type annotations stay uncolored.What is the new behavior?
scssis added toadditionalLanguages.<script lang="ts">blocks use the TypeScript grammar. A plain<script>stays JavaScript.htmlblocks share the Vue grammar, so Vue code written as```htmlgets the directive colors too. So do Angular template refs:#content,#swiperand#inputon Angular Quickstart, Angular Slides and Managing Focus, in docs and v8.Does this introduce a breaking change?
Other information
How to test
router-linksection and compare it with production. The:router-animationdirective uses the keyword color, whilerouter-linkkeeps the attribute color.defineProps<{ id: string }>(),stringis highlighted as a type.Stacked on #4867.