Skip to content

Tags: symfony-tools/docs-builder

Tags

0.27.1

Toggle 0.27.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Make behavior of PHP and GitHub references consistent (#191)

0.27.0

Toggle 0.27.0's commit message
feature #190 Add support for phpclass reference with namespace (alami…

…rault)

This PR was merged into the main branch.

Discussion
----------

Add support for phpclass reference with namespace

PHP have now classes with namespaces but it is not supported by `:phpclass:` reference yet

https://www.php.net/manual/en/class.bcmath-number.php

Commits
-------

9a75cd7 Add support for phpclass reference with namespace

v0.26.5

Toggle v0.26.5's commit message
bug #180 Highlight nested PHP comments (javiereguiluz, wouterj)

This PR was merged into the main branch.

Discussion
----------

Highlight nested PHP comments

Related to symfony/symfony-docs#20121

This PR adds a failing test that shows the issue. This is the output change that would make test pass:

```diff
-                ), [ // wait
-                <span class="hljs-number">5</span>
-                seconds before processing
+                ), [
+                <span class="hljs-comment">// wait 5 seconds before processing</span>
```

Commits
-------

af7ee47 Allow one line comments in argument list
8f09af6 Highlight nested PHP comments

v0.26.4

Toggle v0.26.4's commit message
feature #184 Add support for inline Twig comments (javiereguiluz)

This PR was merged into the main branch.

Discussion
----------

Add support for inline Twig comments

Twig added inline comments (twigphp/Twig#4349) so I tried to add support for them here. But, it's not working. Anyone knows if this could be easy to fix or if it's too complex to do it? Thanks!

Commits
-------

126cfbf Add support for inline Twig comments

v0.26.3

Toggle v0.26.3's commit message
minor #182 Don't use the deprecated spaceless filter (javiereguiluz)

This PR was merged into the main branch.

Discussion
----------

Don't use the deprecated spaceless filter

This fixes the following deprecations that are making CI to fail:

```
Remaining indirect deprecation notices (3)

  1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/toc.html.twig at line 1.
    1x in BuildDocsCommandTest::testBuildDocsDefault from App\Tests\Command

  1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/link.html.twig at line 1.
    1x in BuildDocsCommandTest::testBuildDocsDefault from App\Tests\Command

  1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/figure.html.twig at line 4.
    1x in IntegrationTest::testParseUnitBlock from SymfonyDocsBuilder\Tests
```

Commits
-------

f34b7a7 Don't use the deprecated spaceless filter

v0.26.2

Toggle v0.26.2's commit message
bug #179 🐛 Fix yaml number rendering (homersimpsons)

This PR was squashed before being merged into the main branch.

Discussion
----------

:bug: Fix yaml number rendering

Fixes #177

I copied the yaml.json file from https://github.com/scrivo/highlight.php/blob/d1c6b0956a2b0d3efc137e4d8c5bf5c5e220bac1/src/Highlight/languages/yaml.json#L84 and updated the "number" regex to add `_` where I think the symfony parser allow them:
```diff
- "begin": "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)\\b"
+ "begin": "(-?)(\\b0[xX][a-fA-F0-9_]+|(\\b\\d[\\d_]*(\\.[\\d_]*)?|\\.\\d[\\d_]*)([eE][-+]?\\d[\\d_]*)?)\\b"
```

There may be additional places where the symfony parser allow the `_` for numbers.

I also updated the tests to add the example from the documentation.

Commits
-------

e7c0a06 🐛 Fix yaml number rendering

v0.26.1

Toggle v0.26.1's commit message
bug #178 Fix attribute arguments highlighting and better support CPP …

…(wouterj)

This PR was merged into the main branch.

Discussion
----------

Fix attribute arguments highlighting and better support CPP

`@javiereguiluz` after seeing my changes online, I discovered 2 minor bugs that are fixed with this PR:
- Highlight `public`/`protected`/`private` when using constructor property promotion
- Fix highlighting attribute arguments (these were now parsed as function definition parameters instead of invocation arguments, e.g. lacking named argument support)

Commits
-------

a467bd9 Fix attribute arguments highlighting and better support CPP

v0.26.0

Toggle v0.26.0's commit message
feature #176 Add more modern PHP syntax highlighting (wouterj)

This PR was squashed before being merged into the main branch.

Discussion
----------

Add more modern PHP syntax highlighting

Because I had fun playing around with this, I've added more changes to the PHP syntax file, bringing it more or less up to date with Highlight.js' syntax file.

Noteworthy changes:
* Support arrow functions, enums, match statement, named arguments and more constants
* Updated the full list of supported PHP types
* Identify function class/class instantiations (this improves highlighting function arguments)

`@javiereguiluz` please test this out locally. This patch will generally add more color to the code blocks. You might want to tweak the CSS a bit depending on your favor (we seem to have relatively little coloring in our code examples).
E.g. function calls now get `hljs-title` as well (you can use `.invoke__` to differentiate them from other titles), and named arguments will be labelled as `hljs-attr` (which is currently colored similar to `hljs-meta` used for PHP attributes).

| Before | After
| --- | ---
| ![image](https://github.com/symfony-tools/docs-builder/assets/749025/f38b5b93-f7e7-4bde-9be7-4b8f07adf961) | ![image](https://github.com/symfony-tools/docs-builder/assets/749025/cc2b36d7-73d0-4bc9-a151-6b1aaf699d7c)
| ![image](https://github.com/symfony-tools/docs-builder/assets/749025/5d0054ed-f3cf-459f-b079-1ace730dadea) | ![image](https://github.com/symfony-tools/docs-builder/assets/749025/c57facf0-101c-414d-92cd-c2f3c514d2f8)
| ![image](https://github.com/symfony-tools/docs-builder/assets/749025/89fc8e5f-a513-4c37-8ae1-8015a2960e55) | ![image](https://github.com/symfony-tools/docs-builder/assets/749025/5c772837-027c-4ae8-929e-9aaab12fc05f)

Commits
-------

0642507 Add more modern PHP syntax highlighting

v0.25.0

Toggle v0.25.0's commit message
bug #175 Fixes for PHP attribute parsing (wouterj)

This PR was squashed before being merged into the main branch.

Discussion
----------

Fixes for PHP attribute parsing

- No longer wrap the entire attribute in a span, but only wrap `#[Route` and `]` in spans (fixes #174)
- `@javiereguiluz` for consistency with the real PHP highlight.js file, I've renamed `php-attributes` to `meta`. Is it OK for you to update the CSS on symfony.com to style `.hljs-meta` instead of `.hljs-php-attributes`?
- Fixed not parsing attributes in parameters, see e.g. https://symfony.com/doc/current/controller.html#mapping-the-whole-query-string

Commits
-------

de706b5 Fixes for PHP attribute parsing

v0.24.0

Toggle v0.24.0's commit message
feature #173 Update the php syntax file to highlight attributes (javi…

…ereguiluz, wouterj)

This PR was merged into the main branch.

Discussion
----------

Update the php syntax file to highlight attributes

Alternative to #172 (as per my suggestion).

`@javiereguiluz` what do you think of this? The output is slightly different from yours, but that's how highlight.js works :)

I tried my suggestion of converting the latest highlight.js syntax file, this unfortunately didn't work (there are too many BC breaks in v10). So I've copy pasted their regex and used it to what is available in our syntax file already.

If we want to go this way, I can also follow up with a PR adding more support for PHP features (e.g. arrow functions). For now, I've just added a couple keywords that plainly were missing (such as trait and enum).

Commits
-------

020a281 Add support for PHP attributes
9764478 Add tests for highlighting PHP attributes