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

Raw text outside tags causes broken HTML to be rendered #13

Closed
allejo opened this issue Feb 17, 2020 · 7 comments · Fixed by #14
Closed

Raw text outside tags causes broken HTML to be rendered #13

allejo opened this issue Feb 17, 2020 · 7 comments · Fixed by #14
Labels
bug Something isn't working

Comments

@allejo
Copy link
Owner

allejo commented Feb 17, 2020

My Markdown HTML

Some text<p data-name="short_description">Defines which sample file the region will play.</p>

<p>Possibly the most important opcode, this is the one that tells the sampler which
sample file to actually play. This should include a relative file path from the
folder where the SFZ file is.</p>

<h2 id="examples">Examples</h2>

Snippet Usage

{% include anchor_headings.html html=content %}

Expected HTML

Some text<p data-name="short_description">Defines which sample file the region will play.</p>

<p>Possibly the most important opcode, this is the one that tells the sampler which
sample file to actually play. This should include a relative file path from the
folder where the SFZ file is.</p>

<h2 id="examples">Examples <a href="#examples"></a></h2>

Actual HTML

<hSome text<p data-name="short_description">Defines which sample file the region will play.</p>

<p>Possibly the most important opcode, this is the one that tells the sampler which
sample file to actually play. This should include a relative file path from the
folder where the SFZ file is.</p>

<h2 id="examples">Examples <a href="#examples"></a></h2>

Notes

Reported by the @sfzformat team

@allejo allejo added the bug Something isn't working label Feb 17, 2020
@redtide
Copy link

redtide commented Feb 17, 2020

Just tested the hotfix and it fixed the tag issue.

I wonder if there is a need to document that specific case BTW, where the script works 2 times (adding 2 heading anchors) when called by 2 layouts used in different pages, where 1 inherits the other.
The behavior looks obvious to me but IDK if there is also a way to handle some nested case like that from within the script.

@allejo
Copy link
Owner Author

allejo commented Feb 17, 2020

Just tested the hotfix and it fixed the tag issue.

🎉

I wonder if there is a need to document that specific case BTW, where the script works 2 times (adding 2 heading anchors) when called by 2 layouts used in different pages, where 1 inherits the other.
The behavior looks obvious to me but IDK if there is also a way to handle some nested case like that from within the script.

Documenting this behavior wouldn't hurt; e01729a.

As for adding support for nesting, I think it would be limited; I could check to see if there's already an anchor in the heading and skip adding a new one if there is. I'm just curious to know if there's a use case for this behavior where this script would legitimately be used twice.

@redtide
Copy link

redtide commented Feb 17, 2020

As for adding support for nesting, I think it would be limited; I could check to see if there's already an anchor in the heading and skip adding a new one if there is. I'm just curious to know if there's a use case for this behavior where this script would legitimately be used twice.

That is what happens in the sfzformat website; one layout is the default for all pages without particular requirements, the other is for some pages that uses both default plus some specific additions (tables and some other info generated from a yml file) added on it. The double heading anchor can be seen in the 'Example' heading on one of the pages referred in the home in the test branch.
That's why I used that workaround, to use the script only once.

@allejo
Copy link
Owner Author

allejo commented Feb 17, 2020

Does using the script only in the default layout not suffice? I thought a child layout's content would be passed up to its parent and if its parent is in charge of the anchors, then it'd work. If that's not the case, I can add the check.

@redtide
Copy link

redtide commented Feb 17, 2020

You are right, it seems I was confused by the other issue and I haven't tried the obvious logic.

@redtide
Copy link

redtide commented Feb 17, 2020

Updated, thank you for your help!

@allejo
Copy link
Owner Author

allejo commented Feb 17, 2020

Sure thing! Thanks a lot for bringing this issue to my attention 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants