Skip to content
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

Bugfix/31 anchor name formatting amends #34

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Jun 16, 2023

Description

  1. Adds decoding of special chars before generating anchor names.

Example:

{{ tag('h2', {
    text: "We'd love to hear from you",
})|anchors }}

was producing an anchor of: we-039-d-love-to-hear-from-you, while {% apply anchors() %} and |anchors were producing: wed-love-to-hear-from-you.

Now all 3 options produce: wed-love-to-hear-from-you.

  1. Adds lowercase attribute, which defaults to false and produces the same behaviour as before. If set to true, it ensures that the entire anchor is lowercase.
    The default behaviour stays as is: lowercase words that are all uppercase and lowercase the first letter in any other case.

Example:

{% apply anchors('h2') %}
    <h2>Pitch FAQs</h2>
{% endapply %}

still produces: pitch-fAQs

{% apply anchors('h2', lowercase=true) %}
    <h2>Pitch FAQs</h2>
{% endapply %}

produces: pitch-faqs

Applies to v2 and v3.

@brandonkelly if you think point 2 is not something we should pursue or it should be changed to a configuration setting, please let me know, and I’ll adjust. I’m thinking this version gives the best flexibility.

Related issues

#31

@angrybrad angrybrad merged commit 16826b4 into v2 Jun 22, 2023
@angrybrad angrybrad deleted the bugfix/31-anchor-name-formatting-amends branch June 22, 2023 00:50
angrybrad added a commit that referenced this pull request Jun 22, 2023
@angrybrad angrybrad mentioned this pull request Jun 26, 2023
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.

2 participants