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

fix: only warn if langPrefix is changed #2796

Merged
merged 1 commit into from May 6, 2023

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented May 4, 2023

Marked version: 5.0.0

Description

This removes the warning for langPrefix unless it is changed.

The default warnings can be silenced by setting the following options:

marked.use({
  mangle: false,
  headerIds: false
});

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

@vercel
Copy link

vercel bot commented May 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marked-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2023 3:36am

Copy link
Contributor

@calculuschild calculuschild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. This seems reasonable.

src/defaults.js Outdated
@@ -9,7 +9,7 @@ export function getDefaults() {
headerPrefix: '',
highlight: null,
hooks: null,
langPrefix: 'language-',
langPrefix: null,
Copy link
Member

@styfle styfle May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is semver major because its a breaking change to the public API

import marked from 'marked';
const result = marked.getDefaults();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered using (and is it possible to use) empty types instead of null?

Coming at it from someone who doesn't know the architecture and intent, I'd need to search and find what's expected from the argument list, yeah?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true. And any extensions that rely on options.langPrefix could break.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this PR to only check if langPrefix has changed from it's default value before warning about it.

@UziTech UziTech changed the title fix: default langPrefix to null fix: only warn if langPrefix is changed May 6, 2023
@UziTech UziTech merged commit d193694 into markedjs:master May 6, 2023
11 checks passed
github-actions bot pushed a commit that referenced this pull request May 6, 2023
## [5.0.1](v5.0.0...v5.0.1) (2023-05-06)

### Bug Fixes

* only warn if langPrefix is changed ([#2796](#2796)) ([d193694](d193694))
@UziTech UziTech deleted the langPrefix-null branch August 26, 2023 03:23
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

4 participants