-
Notifications
You must be signed in to change notification settings - Fork 17
Generate config example #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| for (const { placeholder, value } of replacements) { | ||
| const before = content; | ||
| content = content.replace(placeholder, () => value); |
There was a problem hiding this comment.
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 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one for https://github.com/denysdovhan/wtfjs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True haha 😄
e8e5f17 to
16acadd
Compare
katrinafyi
left a comment
There was a problem hiding this 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.
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