Skip to content

Commit

Permalink
SCSS: Highlight parent selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Jul 7, 2016
1 parent 13fed76 commit 8f5f1fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions components/prism-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Prism.languages.scss = Prism.languages.extend('css', {
// Initial look-ahead is used to prevent matching of blank selectors
pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,
inside: {
'parent': {
pattern: /&/,
alias: 'important'
},
'placeholder': /%[-_\w]+/,
'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-scss.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/languages/scss/selector_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ p, div {}
["selector", ["a "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", ["p, div "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", ["#foobar .foo "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", ["&:hover "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", ["&-sidebar "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", [["parent", "&"], ":hover "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", [["parent", "&"], "-sidebar "]], ["punctuation", "{"], ["punctuation", "}"],
["selector", ["#context a", ["placeholder", "%extreme"]]], ["punctuation", "{"], ["punctuation", "}"],
["selector", [["variable", "#{$selector}"], ":before "]], ["punctuation", "{"], ["punctuation", "}"]
]
Expand Down

0 comments on commit 8f5f1fa

Please sign in to comment.