Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,19 @@ snippet **name is the join key** — the docs repo has a `<!--SNIPSTART name-->`
`<!--SNIPEND-->` placeholder in the target `.mdx` page, and Snipsync (run on the
docs-repo side) copies the code across by matching names.

```java
// @@@SNIPSTART java-s3-driver-create
<!--
This example is an HTML <pre> block that spells the first @ as &#64;.
Snipsync reads every file in this repo, including Markdown, and treats any
line with the literal marker text as a real snippet. Keep the entity so the
example doesn't register a snippet.
-->

<pre>
// &#64;@@SNIPSTART java-example-name
S3AsyncClient s3Client = S3AsyncClient.builder().region(Region.US_EAST_2).build();
...
// @@@SNIPEND
```
// &#64;@@SNIPEND
</pre>

Use `#` instead of `//` for Python and Ruby. Naming convention: `<language>-<topic>-<detail>`,
e.g. `java-s3-driver-create` (see
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,29 @@ docs. The `.mdx` page in the `documentation` repo has
`<!--SNIPSTART name-->` / `<!--SNIPEND-->`, and Snipsync copies the code with the
same name into it.

```java
// @@@SNIPSTART java-s3-driver-create
<!--
The marker examples below are HTML <pre> blocks that spell the first @ as
&#64;. Snipsync reads every file in this repo, including Markdown, and treats
any line with the literal marker text as a real snippet. Keep the entity so
these examples don't register snippets.
-->

<pre>
// &#64;@@SNIPSTART java-example-name
S3AsyncClient s3Client = S3AsyncClient.builder().region(Region.US_EAST_2).build();
// @@@SNIPEND
```
// &#64;@@SNIPEND
</pre>

- Use `#` instead of `//` for Python and Ruby.
- In PHP, Snipsync leaves out the marker line, and nothing can come before
`<?php`. To include `<?php` in a whole-file snippet, put the marker on the
first line and reopen the tag on the next line:

```php
<?php // @@@SNIPSTART php-quickstart-worker ?>
<?php
<pre>
&lt;?php // &#64;@@SNIPSTART php-example-name ?&gt;
&lt;?php
declare(strict_types=1);
```
</pre>

The closing `?>` swallows its newline, so the file prints nothing and
`declare(strict_types=1)` still works.
Expand Down
5 changes: 3 additions & 2 deletions php-sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ best-practices/testing-suite/test.sh

## Snipsync markers

The PHP files start with `<?php // @@@SNIPSTART ... ?>` followed by a second
`<?php`, so the snippet on the docs page includes the opening tag. See
The PHP files put the Snipsync start marker inside a `<?php ... ?>` first line,
followed by a second `<?php`, so the snippet on the docs page includes the
opening tag. See
[Snipsync markers](../README.md#snipsync-markers).
5 changes: 3 additions & 2 deletions php-sandbox/client/temporal-client/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# vendor/bin/phpstan analyse -c client/temporal-client/phpstan.neon
#
# The Workflow interfaces aren't analysed directly: PHPStan reports their
# `<?php // @@@SNIPSTART ... ?>` first line as "declare(strict_types) must be
# the very first statement", but PHP itself still enforces strict types there.
# first line, which holds the Snipsync start marker inside `<?php ... ?>`, as
# "declare(strict_types) must be the very first statement", but PHP itself
# still enforces strict types there.
parameters:
level: 5
paths:
Expand Down
Loading