Skip to content

Conversation

@thomas-zahner
Copy link
Member

Thanks to @katrinafyi we now have a way of generating content in the docs from files of the main lychee repository. This is a follow-up PR making the base functionality applicable to other use-cases. Additionally closes lycheeverse/lychee#1768


for (const { placeholder, value } of replacements) {
const before = content;
content = content.replace(placeholder, () => value);
Copy link
Member Author

Choose a reason for hiding this comment

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

Something quite interesting I learned is that replace on String knows special values for the replacement value like $'. This caused problems for the config file as replacement value. By using a function instead this weird behaviour is disabled. Average JavaScript developer experience I guess 🤷

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

True haha 😄

@thomas-zahner thomas-zahner force-pushed the generate-config-example branch from e8e5f17 to 16acadd Compare November 18, 2025 15:04
@thomas-zahner thomas-zahner requested a review from mre November 18, 2025 15:04
Copy link
Contributor

@katrinafyi katrinafyi left a comment

Choose a reason for hiding this comment

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

I'm very happy to see the fetching code generalised and reused! Alongside the unit test in the main repo, this is a great improvement for documentation.

@thomas-zahner thomas-zahner merged commit 3af627b into master Nov 20, 2025
2 checks passed
@mre mre deleted the generate-config-example branch November 20, 2025 16:02
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.

Keep example config file and documentation up to date

4 participants