Skip to content

fix: only warn if langPrefix is changed#2796

Merged
UziTech merged 1 commit intomarkedjs:masterfrom
UziTech:langPrefix-null
May 6, 2023
Merged

fix: only warn if langPrefix is changed#2796
UziTech merged 1 commit intomarkedjs:masterfrom
UziTech:langPrefix-null

Conversation

@UziTech
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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.

Comment thread src/defaults.js Outdated
highlight: null,
hooks: null,
langPrefix: 'language-',
langPrefix: null,
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 force-pushed the langPrefix-null branch from 6ba2068 to efc0b97 Compare May 6, 2023 03:36
@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
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
Logiclayer1111 pushed a commit to Logiclayer1111/marked that referenced this pull request Apr 20, 2026
## [5.0.1](markedjs/marked@v5.0.0...v5.0.1) (2023-05-06)

### Bug Fixes

* only warn if langPrefix is changed ([#2796](markedjs/marked#2796)) ([6c43252](markedjs/marked@6c43252))
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.

4 participants