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: deprecate options #2766

Merged
merged 11 commits into from
May 2, 2023
Merged

fix: deprecate options #2766

merged 11 commits into from
May 2, 2023

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Mar 30, 2023

🚨 BREAKING CHANGE 🚨

do not submit until we are ready to release v5.0.0

Description

Deprecate the following options:

Option Replacement
highlight, langPrefix, and callback marked-highlight
mangle marked-mangle
baseUrl marked-base-url
smartypants marked-smartypants
xhtml marked-xhtml
headerIds and headerPrefix marked-gfm-heading-id

This will be a breaking change so should be done in the next major version.

This only deprecates the options it does not remove them yet. Ideally we will deprecate these in v5.0.0 and remove them in a later major release.

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 Mar 30, 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 Apr 11, 2023 2:58am

Copy link
Member

@joshbruce joshbruce left a comment

Choose a reason for hiding this comment

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

Is it possible to make syntax highlighting completely opt in?

An extension that could be added like middleware. Thinking PHP League\Commonmark and Spatie\CommonmarkHighlighter.

I recognize with this solution users can use any highlighter. I'm wondering if it's possible for users to be able to use any highlighter and for Marked to not have to explicitly consider it.

@UziTech
Copy link
Member Author

UziTech commented Mar 30, 2023

Is it possible to make syntax highlighting completely opt in?

Yes I could create a marked-highlighter extension that does essentially what this PR does (adds a walkTokens function).

That might be better. Then we can deprecate the highlighter option.

@calculuschild
Copy link
Contributor

I agree. Better to break it out into an extension.

@UziTech UziTech changed the title feat: allow highlight to return a promise and deprecate callback feat: deprecate highlight and callback Mar 31, 2023
@UziTech
Copy link
Member Author

UziTech commented Mar 31, 2023

I created marked-highlight and changed this so it only deprecates highlight and callback.

I updated the docs to recommend using marked-highlight for highlighting code.

@UziTech UziTech mentioned this pull request Mar 31, 2023
5 tasks
@UziTech UziTech changed the title feat: deprecate highlight and callback BREAKING CHANGE: deprecate highlight and callback Mar 31, 2023
docs/USING_ADVANCED.md Outdated Show resolved Hide resolved
docs/USING_ADVANCED.md Outdated Show resolved Hide resolved
Co-authored-by: Steven <steven@ceriously.com>
@UziTech UziTech changed the title BREAKING CHANGE: deprecate highlight and callback BREAKING CHANGE: deprecate options Apr 1, 2023
@UziTech
Copy link
Member Author

UziTech commented Apr 1, 2023

I also deprecated the mangle option in this PR. I figure we should do all of the easy ones at once so users don't have to update their options too many times.

@UziTech
Copy link
Member Author

UziTech commented Apr 1, 2023

headerIds and headerPrefix can also be deprecated by the marked-gfm-heading-id extension.

And I will create an extension for baseUrl.

@UziTech
Copy link
Member Author

UziTech commented Apr 5, 2023

I think I am done working on this. I got all of the unnecessary options deprecated and moved to extensions. @joshbruce @calculuschild @styfle can you review this again?

src/helpers.js Outdated Show resolved Hide resolved
@UziTech UziTech changed the title BREAKING CHANGE: deprecate options fix: deprecate options May 2, 2023
@UziTech UziTech merged commit 62d3312 into markedjs:master May 2, 2023
9 checks passed
@UziTech UziTech deleted the async-highlight branch May 2, 2023 04:30
github-actions bot pushed a commit that referenced this pull request May 2, 2023
# [5.0.0](v4.3.0...v5.0.0) (2023-05-02)

### Bug Fixes

* deprecate options ([#2766](#2766)) ([62d3312](62d3312))
* update min node to v18 ([#2767](#2767)) ([c6852f5](c6852f5))

### Features

* add block param to html renderer ([#2768](#2768)) ([fa21b9f](fa21b9f))

### BREAKING CHANGES

* deprecate options
* minimum supported node version v18
colinrotherham added a commit to alphagov/govuk-design-system that referenced this pull request Aug 14, 2023
The marked option `{ smartypants: true }` has been deprecated so we must use `marked-smartypants` here instead

Note: Metalsmith’s `jstransformer-marked` still uses `marked@4.3.0` so we can’t migrate to `marked-smartypants`

markedjs/marked#2766
colinrotherham added a commit to alphagov/govuk-design-system that referenced this pull request Aug 15, 2023
The marked option `{ smartypants: true }` has been deprecated so we must use `marked-smartypants` here instead

Note: Metalsmith’s `jstransformer-marked` still uses `marked@4.3.0` so we can’t migrate to `marked-smartypants`

markedjs/marked#2766
colinrotherham added a commit to alphagov/govuk-design-system that referenced this pull request Aug 23, 2023
The marked option `{ smartypants: true }` has been deprecated so we must use `marked-smartypants` here instead

Note: Metalsmith’s `jstransformer-marked` still uses `marked@4.3.0` so we can’t migrate to `marked-smartypants`

markedjs/marked#2766
colinrotherham added a commit to alphagov/govuk-design-system that referenced this pull request Aug 29, 2023
The marked option `{ smartypants: true }` has been deprecated so we must use `marked-smartypants` here instead

Note: Metalsmith’s `jstransformer-marked` still uses `marked@4.3.0` so we can’t migrate to `marked-smartypants`

markedjs/marked#2766
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