Skip to content

Keep Snipsync marker examples from registering snippets - #312

Draft
Duncanma wants to merge 1 commit into
mainfrom
duncan/snipsync-marker-examples
Draft

Duncanma wants to merge 1 commit into
mainfrom
duncan/snipsync-marker-examples

Conversation

@Duncanma

Copy link
Copy Markdown
Contributor

What

Snipsync reads every file in this repo, including Markdown and config comments, and treats any line that contains the literal start marker as a real snippet. It has no escape form. Four files registered snippets by accident:

File What Snipsync saw
README.md Duplicate java-s3-driver-create, plus duplicate php-quickstart-worker with no end marker, so it captured to the end of the README
CONTRIBUTING.md Duplicate java-s3-driver-create
php-sandbox/README.md Unterminated snippet named ...
php-sandbox/client/temporal-client/phpstan.neon Unterminated snippet named ...

The real php-quickstart-worker (in php-sandbox/worker.php) feeds docs/develop/php/set-up.mdx, and the real java-s3-driver-create feeds the Java external storage page. Today the real snippets win, but only because of file order. Snipsync 1.14 now warns about these on every docs sync.

Change

  • README.md and CONTRIBUTING.md: the marker examples are now <pre> blocks that spell the first @ as &#64;, with placeholder names (java-example-name, php-example-name). GitHub renders them the same as before. An HTML comment above each block explains the entity so nobody "fixes" it back.
  • php-sandbox/README.md and phpstan.neon: the prose now describes the marker line without containing the marker.

Validation

I ran Snipsync 1.14.0 locally against main and against this branch, with local-file origins for this repo, samples-go, and samples-typescript:

  • On main it warns about unterminated php-quickstart-worker in README.md and unterminated ... in php-sandbox/README.md and phpstan.neon.
  • On this branch it prints no warnings for this repo.

I also rendered the README section with GitHub's Markdown API. Both examples show the literal @@@SNIPSTART / @@@SNIPEND markers.

Companion fixes for the same warnings: temporalio/samples-go (cancellation SNIPEND) and temporalio/samples-typescript (stray Nexus SNIPENDs).

Snipsync reads every file in this repo, including Markdown and config
comments, and treats any line containing the literal start marker as a real
snippet. The marker examples in README.md and CONTRIBUTING.md registered
duplicate java-s3-driver-create and php-quickstart-worker snippets (the PHP
one unterminated, so it captured to the end of README.md), and the prose in
php-sandbox/README.md and phpstan.neon registered unterminated "..." snippets.
Snipsync 1.14 warns about all of these.

Render the examples as <pre> blocks that spell the first @ as &#64;, with
placeholder names, and rephrase the prose so it no longer contains the marker.
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.

1 participant