8000 Place plugin docs along with their source code by DmitrySharabin · Pull Request #3930 · PrismJS/prism · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Place plugin docs along with their source code #3930

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 4 commits into from
May 8, 2025
Merged

Conversation

DmitrySharabin
Copy link
Contributor

No description provided.

Copy link
netlify bot commented May 7, 2025

Deploy Preview for dev-prismjs-com ready!

Name Link
🔨 Latest commit ddc83cb
🔍 Latest deploy log https://app.netlify.com/sites/dev-prismjs-com/deploys/681cb9309e8743000727f80c
😎 Deploy Preview https://deploy-preview-3930--dev-prismjs-com.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
github-actions bot commented May 7, 2025

No JS Changes

Generated by 🚫 dangerJS against ddc83cb


If you need more control, you can provide a function to `registerButton` that returns either a `span`, `a`, or `button` element.

```js
Copy link
Member

Choose a reason for hiding this comment

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

This applies to other demo.js files (but possibly not all): Instead of including a separate demo.js that basically duplicates what is here, can we have a class or something that we can add to code examples and have them get a "Run" button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes sense. Though I think there is a demo.js file that should have another name: it's just a script that runs some functionality on the docs page, not related to demos (IIRC, it's related to the autoloader plugin). I should revert its name to script.js.

Copy link
Member
@LeaVerou LeaVerou left a comment

Choose a reason for hiding this comment

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

See comments, but I'm fine to merge this and work on them later.

@LeaVerou
Copy link
Member
LeaVerou commented May 7, 2025

Also, we'll eventually do this for v1 too, right?

@DmitrySharabin
Copy link
Contributor Author

See comments, but I'm fine to merge this and work on them later.

Yeah, I'd rather work on proposed improvements a bit later.

Also, we'll eventually do this for v1 too, right?

Something like that, yes. Except we don't build the v1 website with 11ty; I figure that's fine, though, since eventually, it might become some sort of archive website.

@DmitrySharabin DmitrySharabin merged commit d528f30 into v2 May 8, 2025
13 of 15 checks passed
@DmitrySharabin DmitrySharabin deleted the plugin-docs branch May 8, 2025 14:04
@LeaVerou
Copy link
Member
LeaVerou commented May 8, 2025

Except we don't build the v1 website with 11ty; I figure that's fine, though, since eventually, it might become some sort of archive website.

We should. We've already done most of the work! And we'd want to update the v1 website even before v2 launches, e.g. to add a banner to let people know that we're working on v2, or to improve its IA and the list of websites using Prism, etc.

@DmitrySharabin
Copy link
Contributor Author

Except we don't build the v1 website with 11ty; I figure that's fine, though, since eventually, it might become some sort of archive website.

We should. We've already done most of the work! And we'd want to update the v1 website even before v2 launches, e.g. to add a banner to let people know that we're working on v2, or to improve its IA and the list of websites using Prism, etc.

Let's do it, then! 🙂

DmitrySharabin added a commit that referenced this pull request Jul 11, 2025
* Place plugin docs along with their source code (#3930)

* [autoloader] Fix script name in the docs

* [normalize-whitespace] Don't consider demo as a plugin

* Generate `file-sizes.json` during the build (#3946)

* Exclude plugins' `demo.js` files from type checking

* Fix path to the core entry point in `components.json`

* Move and rename themes (#3947)

- Move themes to the `src` folder and remove the `prism-` prefix
- Adjust the build process accordingly
- Adjust themes' metadata:
    - Remove broken links
    - Add/update authors' full names
    - Update GitHub handles
    - Use Markdown-style links
    - In `components.json`, fix theme ids and add Lea Verou as the owner to the prism, dark, and funky themes

* Update themes' docs (#3958)

So that they follow the structure (we can parse and use on the website):

```
/**
 * <title>
 *
 * <description>
 *
 * @author <name> (<GitHub_username>)
 */
```

Between the data chunks, there should be at least one empty line.

* Move `combineCallbacks` to its own module (#3963)

* Move the `Token` class under the `classes` folder

* Move all utils for working with iterables to a separate module

Remove unused utils

* Simplify hooks

* Move the `Prism` class, add Prism singleton

* Simplify the `Prism` class

Move to separate modules:
- `highlightAll()`
- `highlightElement()`
- `highlight()`
- `stringify()`

* Correctly parse CLI arguments (#3972)

Was fixed in #3949 (in the `simplify` branch). Move it here to make testing easier.

* Simplify the `Prism` class even more

- Move `tokenize()`, `_matchGrammar()` (and related code), and `resolve()` to separate modules.
- Ditch the `tokenize` symbol in favor of the `$tokenize` special property. Since symbols are excluded from the `for…in` loop, and `$tokenize` is not a symbol, to preserve the previous behavior, we need to handle it in `_matchGrammar` explicitly.
- Switch from `[tokenize]` to `$tokenize` in languages.

---
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>

* Ditch the `rest` symbol in favor of the `$rest` special property

* Move language utils to `util/` and separate them out

* Remove known plugins + type safety

* Move `documentReady` to async utils

* Make the global bundle of Prism v2 work the same way as Prism v1 does

Now, the user can include Prism the way they used to (except v2 now uses the Autoloader plugin under the hood, so more languages can be highlighted right out of the box):

```html
<link rel="stylesheet" href="themes/prism.css" />
<script src="prism.js"></script>
```

Besides, they have access to the Prism instance via `globalThis`.

* Move Prism config to a separate file and fix the build options of the global bundle

Co-Authored-By: Dmitry Sharabin <dmitrysharabin@gmail.com>

* Fix some code after merging

---------

Co-authored-by: Lea Verou <lea@verou.me>
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.

2 participants
0