Skip to content

feat(rehype): Support default language option #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 7, 2024
Merged

Conversation

fuma-nama
Copy link
Contributor

Description

As the markdown-it integration also provides similar options, this PR adds the defaultLanguage option to the rehype integration.

When no language specified, it uses the default language instead.
Note that it doesn't change the current behaviour. When neither language nor default language is provided, the code block will not be processed by Shiki, hence you can handle it on your own, and won't break existing usages.

Linked Issues

#691

Additional context

unit tests are added.

Copy link

netlify bot commented Jun 2, 2024

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 31571df
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/6662f83f4f07420008b13f5d
😎 Deploy Preview https://deploy-preview-692--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jun 2, 2024

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 31571df
🔍 Latest deploy log https://app.netlify.com/sites/shiki-next/deploys/6662f83f3ab1fe00084edcb0
😎 Deploy Preview https://deploy-preview-692--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu
Copy link
Member

antfu commented Jun 2, 2024

Could you also help to implement the same interface as in #689? Thanks!

@fuma-nama
Copy link
Contributor Author

Added fallbackLanguage option

@antfu antfu merged commit 724b410 into shikijs:main Jun 7, 2024
11 checks passed
renovate bot referenced this pull request in r4ai/r4ai.dev Jun 11, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [shiki](https://togithub.com/shikijs/shiki)
([source](https://togithub.com/shikijs/shiki/tree/HEAD/packages/shiki))
| [`1.6.3` ->
`1.6.4`](https://renovatebot.com/diffs/npm/shiki/1.6.3/1.6.4) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/1.6.3/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/1.6.3/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>shikijs/shiki (shiki)</summary>

### [`v1.6.4`](https://togithub.com/shikijs/shiki/releases/tag/v1.6.4)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.6.3...v1.6.4)

#####    🚀 Features

- Add CSS variables for markup diff tokens  -  by
[@&#8203;SamyPesse](https://togithub.com/SamyPesse) in
[https://github.com/shikijs/shiki/issues/698](https://togithub.com/shikijs/shiki/issues/698)
[<samp>(84c0b)</samp>](https://togithub.com/shikijs/shiki/commit/84c0b539)
- **rehype**: Support default language option  -  by
[@&#8203;fuma-nama](https://togithub.com/fuma-nama) and
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/692](https://togithub.com/shikijs/shiki/issues/692)
[<samp>(724b4)</samp>](https://togithub.com/shikijs/shiki/commit/724b410e)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.6.3...v1.6.4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/r4ai/r4ai.dev).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
diegohaz referenced this pull request in ariakit/ariakit Jun 12, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [shiki](https://togithub.com/shikijs/shiki)
([source](https://togithub.com/shikijs/shiki/tree/HEAD/packages/shiki))
| [`1.6.1` ->
`1.6.4`](https://renovatebot.com/diffs/npm/shiki/1.6.1/1.6.4) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/1.6.1/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/1.6.1/1.6.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>shikijs/shiki (shiki)</summary>

### [`v1.6.4`](https://togithub.com/shikijs/shiki/releases/tag/v1.6.4)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.6.3...v1.6.4)

#####    🚀 Features

- Add CSS variables for markup diff tokens  -  by
[@&#8203;SamyPesse](https://togithub.com/SamyPesse) in
[https://github.com/shikijs/shiki/issues/698](https://togithub.com/shikijs/shiki/issues/698)
[<samp>(84c0b)</samp>](https://togithub.com/shikijs/shiki/commit/84c0b539)
- **rehype**: Support default language option  -  by
[@&#8203;fuma-nama](https://togithub.com/fuma-nama) and
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/692](https://togithub.com/shikijs/shiki/issues/692)
[<samp>(724b4)</samp>](https://togithub.com/shikijs/shiki/commit/724b410e)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.6.3...v1.6.4)

### [`v1.6.3`](https://togithub.com/shikijs/shiki/releases/tag/v1.6.3)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.6.2...v1.6.3)

#####    🚀 Features

- **twoslash**: Add line query rendering option for twoslash renderer
 -  by [@&#8203;hddhyq](https://togithub.com/hddhyq) and
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/695](https://togithub.com/shikijs/shiki/issues/695)
[<samp>(aea25)</samp>](https://togithub.com/shikijs/shiki/commit/aea25115)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.6.2...v1.6.3)

### [`v1.6.2`](https://togithub.com/shikijs/shiki/releases/tag/v1.6.2)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.6.1...v1.6.2)

#####    🚀 Features

- **markdown-it**: Support default and fallback lang
[#&#8203;687](https://togithub.com/shikijs/shiki/issues/687)  -  by
[@&#8203;Only566](https://togithub.com/Only566) and **winnliu** in
[https://github.com/shikijs/shiki/issues/689](https://togithub.com/shikijs/shiki/issues/689)
and
[https://github.com/shikijs/shiki/issues/687](https://togithub.com/shikijs/shiki/issues/687)
[<samp>(3281b)</samp>](https://togithub.com/shikijs/shiki/commit/3281bf5b)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.6.1...v1.6.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ariakit/ariakit).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants