Skip to content

Commit

Permalink
Allow HTML code in the calendar title (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
mweimerskirch authored Aug 17, 2023
1 parent 88b9630 commit 22eacf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,16 @@ function (date) {
</tr>
</table>

The callback function can return HTML markup. If you want to use HTML entities in the title, you must use the callback function:

```js
function (date) {
let month = date.toLocaleDateString('en-US', { month: 'long' })
let year = date.toLocaleDateString('en-US', { year: 'numeric' })
return `<span class="month">${month}</span> <span class="year">${year}</span>`
}
```

### unselect
- Type `function`
- Default `undefined`
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Buttons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

{#each buttons as button}
{#if button == 'title'}
<h2 class="{$theme.title}">{$_viewTitle}</h2>
<h2 class="{$theme.title}">{@html $_viewTitle}</h2>
{:else if button == 'prev'}
<button class="{$theme.button} ec-{button}" aria-label={$buttonText.prev} on:click={prev}><i class="{$theme.icon} ec-{button}"></i></button>
{:else if button == 'next'}
Expand Down

0 comments on commit 22eacf3

Please sign in to comment.