Skip to content

Commit 454575a

Browse files
authored
Fix language prop being ignored (#42)
* Fix language prop being ignored Fixes a logic error which meant autodetection would override an explicit language being given. * Update CHANGELOG.md
1 parent c4e3a91 commit 454575a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.3
2+
3+
- Fix `language` prop being ignored unless `autodetect` is explicitly set to `false` (#41)
4+
15
## 2.1.2
26

37
- Default to `tabindex="0"` on the internal `<code>` element to allow keyboard scrolling when a scrollbar is applied to the element. This resolves an accessibility issue found by Vue-Axe. (#33)

src/vue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const component = defineComponent({
2727
language.value = newLanguage
2828
})
2929

30-
const autodetect = computed(() => props.autodetect || !language.value)
30+
const autodetect = computed(() => props.autodetect && !language.value)
3131
const cannotDetectLanguage = computed(() => !autodetect.value && !hljs.getLanguage(language.value))
3232

3333
const className = computed((): string => {

0 commit comments

Comments
 (0)