Skip to content

Add prism-js to the classes template#25

Merged
tomalec merged 2 commits intotrunkfrom
add/prism-to-classes
Aug 22, 2024
Merged

Add prism-js to the classes template#25
tomalec merged 2 commits intotrunkfrom
add/prism-to-classes

Conversation

@tomalec
Copy link
Contributor

@tomalec tomalec commented Aug 16, 2024

Changes proposed in this Pull Request:

Add prism-js to the classes template to enable code highlighting for code samples in the PHPDocs class.

How to test the changes in this Pull Request:

  1. Generate code reference for the latest release: ./deploy.sh -v --build-only -s 9.1.4
  2. Edit some file locally to add code snippet inside doc block.:
    ./woocommerce/src/Admin/API/Reports/DataStore.php
/**
 * Class description
 *
 * Example:
 * <pre><code class="language-php">class MyDataStore extends DataStore implements DataStoreInterface {
 *     /** Cache identifier. &ast;/
 *     protected $cache_key = 'my_example';
 * </code></pre>
 *
 */
class DataStore extends SqlQuery implements DataStoreInterface {
  1. Generate again from local changes ./deploy.sh -v --build-only -s 9.1.4 --no-download
  2. open file:///path/to/code-reference/build/api/classes/Automattic-WooCommerce-Admin-API-Reports-DataStore.html
Before

image

After

image

to enable code highlighting for code samples in class PHPDocs
@tomalec tomalec self-assigned this Aug 16, 2024
Copy link
Member

@eason9487 eason9487 left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement! Tested with newly merged changes in WooCommerce core and it works well. LGTM.

image

@tomalec tomalec merged commit af0f472 into trunk Aug 22, 2024
@tomalec tomalec deleted the add/prism-to-classes branch August 22, 2024 21:37
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