Skip to content
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

Add an option for handling missing language #1

Closed
talatkuyuk opened this issue Jan 24, 2023 · 1 comment
Closed

Add an option for handling missing language #1

talatkuyuk opened this issue Jan 24, 2023 · 1 comment
Labels
assign self enhancement New feature or request

Comments

@talatkuyuk
Copy link
Contributor

talatkuyuk commented Jan 24, 2023

Some users put a dummy language (for example "unknown") while using code block in markdown if no language provided in order not to conflict with the line numbering and line highlighting properties if for example rehype-prism-plus is used.(here).. They prefer to reserve the first word for the language and go with the dummy language approach:

```unknown {1}
<Component/>
```

For those who want to go with a dummy language (like above "unknown"), needed to set another option (handleMissingLanguageAs) in the remark-flexible-code-titles in order to choose a dummy language string, and the plugin will assign this option into node.lang instead of null. So, the remark-flexible-code-titles will ensure that the dummy language will be rendered in the class attribute of the code tag, without explicitly saying "unknown" in markdown.

Possible usage of the new option could be:

import remarkCodeTitles from "remark-flexible-code-titles";
...
.use(remarkCodeTitles, {
  handleMissingLanguageAs: "unknown", // or "dummy" what so ever
})
@talatkuyuk talatkuyuk added assign self enhancement New feature or request labels Jan 27, 2023
@talatkuyuk
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assign self enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant