Default Selectors
This document describes which HTML elements are processed by nuxt-smartscript by default and which are excluded.
Elements Processed by Default
Container Elements
main
- Main content areasarticle
- Article containerssection
- Content sectionsheader
- Header areasfooter
- Footer areas.content
- Elements with "content" class[role="main"]
- Elements with main ARIA role.prose
- Prose content (common in documentation).blog-post
- Blog post containers.blog-content
- Blog content areas
Heading Elements
All heading levels are processed:
h1
,h2
,h3
,h4
,h5
,h6
Text Content Elements
p
- Paragraphsli
- List itemstd
- Table cellsth
- Table headersblockquote
- Block quotescaption
- Table/figure captionsdt
- Definition termsdd
- Definition descriptionsfigcaption
- Figure captions
Inline Elements
span
- Generic inline containersa
- Linksstrong
- Strong emphasisem
- Emphasisb
- Bold texti
- Italic textsmall
- Small print (often legal text)cite
- Citationsabbr
- Abbreviations
Interactive Elements
button
- Button textlabel
- Form labelslegend
- Fieldset legendssummary
- Details/summary elements
Other Semantic Elements
address
- Contact information
Elements Excluded by Default
Code Elements
pre
- Preformatted code blockscode
- Inline codescript
- Script tagsstyle
- Style tags
Custom Exclusions
.no-superscript
- Elements with this class[data-no-superscript]
- Elements with this data attribute
Already Processed
These classes indicate content already transformed:
sup.ss-sup
- Already superscripted elementssub.ss-sub
- Already subscripted elements.ss-tm
- Trademark symbols.ss-reg
- Registered symbols.ss-ordinal
- Ordinal numbers.ss-chemical
- Chemical formulas.ss-math
- Mathematical notation
Customizing Selectors
You can customize which elements are processed in your nuxt.config.ts
:
typescript
export default defineNuxtConfig({
smartscript: {
selectors: {
// Add more selectors
include: [
...defaultSelectors,
'.my-custom-class',
'custom-element'
],
// Add more exclusions
exclude: [
...defaultExclusions,
'.skip-this',
'[data-raw-text]'
]
}
}
})
Best Practices
- Performance: More specific selectors (classes, IDs) are faster than broad element selectors
- Avoid Over-Processing: Don't include generic containers like
div
unless necessary - Test Thoroughly: When adding new selectors, test that they don't interfere with your layout
- Use Exclusions: Use the exclusion classes/attributes to skip specific elements
Common Use Cases
Documentation Sites
The default selectors work well for documentation with the .prose
class and semantic HTML.
Blogs
Blog-specific classes like .blog-post
and .blog-content
are included by default.
Applications
Interactive elements like buttons and form labels are processed to handle branded UI text.
Legal Text
The small
element is included as it often contains copyright notices and legal text with ® and ™ symbols.