Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

invalid character in title produces dom error #876

Open
tripodsan opened this issue Oct 23, 2020 · 8 comments
Open

invalid character in title produces dom error #876

tripodsan opened this issue Oct 23, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@tripodsan
Copy link
Contributor

tripodsan commented Oct 23, 2020

Description
eg: https://theblog--adobe.hlx.page/en/publish/2019/05/07/adobe-summit-emea-2019.html

Exception during #16/use:html from /nodejsAction/KUMO2xpR/html.js:237146:
InvalidCharacterError: \"data-Thousands of experience-minded marketers from across Europe have converged in London this week for the annual Adobe Summit—The Digital Experience Conference. Among the topics\" did not match the Name production: Unexpected syntax in top
Line 1:
data-Thousands of experience-minded marketers from across Europe have converged in London this week for the annual Adobe Summit—The Digital Experience Conference. Among the topics
              ^^^" 

probably caused here:

el.properties.id = el.properties.id || headingIdentifier;

@tripodsan tripodsan added the bug Something isn't working label Oct 23, 2020
@trieloff
Copy link
Contributor

Looks like we should fix GitHub slugger

@rofe
Copy link
Contributor

rofe commented Oct 23, 2020

It's not the slugger. It's either a bug in the unified markdown parser, or our way of handling sections.

The following markdown reproduces the error locally:

---

Lorem ipsum: dolor

---

---

The text in the first section will be interpreted as frontmatter, and we will try to append data-Lorem ipsum as an attribute to the div, which causes the error. Even if we sanitized the data before adding (which would probably be a good idea regardless), the resulting page output would be missing this text:

<div data-lorem-ipsum="dolor"></div>

This means that it's currently not possible in Helix to have section text containing : . As a workaround, you can simply enter an additional line break before the text.

I think it's incorrect to treat the above as frontmatter since there is an empty line after the ---, but I'm not sure how to proceed here...

@tripodsan
Copy link
Contributor Author

<div data-lorem-ipsum="dolor"></div>

what's wrong with this ?

I think it's incorrect to treat the above as frontmatter since there is an empty line after the ---, but I'm not sure how to proceed here...

but then it's broken. there are no empty lines allowed in frontmatter:

* - There may be no empty line within the frontmatter block; not even lines

but for frontmatter at the beginning of the document, it's different:

* For frontmatter blocks at the beginning of the document, the rules are a bit

we could require that all matter must not contain empty lines....
@trieloff WDYT?

@rofe
Copy link
Contributor

rofe commented Oct 24, 2020

<div data-lorem-ipsum="dolor"></div>

what's wrong with this ?

The expected output of that would be

<div>Lorem ipsum: dolor</div>

but then it's broken. there are no empty lines allowed in frontmatter

👍

we could require that all matter must not contain empty lines....
@trieloff WDYT?

👍

@trieloff
Copy link
Contributor

I think forbidding empty lines in matter is too harsh, as you might want to use empty lines to structure your YAML.

@rofe
Copy link
Contributor

rofe commented Oct 24, 2020

What about forbidding leading empty lines? So this

---
class: bla

foo: bar

---

would become YAML but

---

hey: you

---

would become HTML

@tripodsan
Copy link
Contributor Author

I think forbidding empty lines in matter is too harsh, as you might want to use empty lines to structure your YAML.

but it's already like this in mid-matter...

@trieloff
Copy link
Contributor

We have a bit more leeway in being restrictive with midmatter because it is a Helix invention. For frontmatter, let's be as gradual in changing things as possible, i.e. only disallow leading empty lines.

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

No branches or pull requests

3 participants