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

bug: Can not handle `<!DOCTYPE html>` correctly #24

Closed
JounQin opened this issue Oct 5, 2019 · 11 comments · Fixed by #25
Closed

bug: Can not handle `<!DOCTYPE html>` correctly #24

JounQin opened this issue Oct 5, 2019 · 11 comments · Fixed by #25
Assignees
Labels

Comments

@JounQin
Copy link
Contributor

@JounQin JounQin commented Oct 5, 2019

<!DOCTYPE html>
html(lang="zh-Hans-CN")
  head
    meta(charset="UTF-8")
    meta(name="viewport", content="width=device-width, initial-scale=1.0")
    meta(http-equiv="X-UA-Compatible", content="ie=edge")
    link(rel="manifest", href="/manifest.json")
    title #{ htmlWebpackPlugin.options.title }
  body
    #root
Error: Unhandled token: {"type":"text-html","loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":16}},"val":"<!DOCTYPE html>"}
@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

I will fix this soon (maybe next 24h hours)

In the meanwhile try pug doctype

@JounQin

This comment has been minimized.

Copy link
Contributor Author

@JounQin JounQin commented Oct 5, 2019

Yep, I've migrated to built-in doctype.

The original content is generated by VSCode emmet.

@Shinigami92 Shinigami92 self-assigned this Oct 5, 2019
@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

Ok, I will also deal with VSCode. Maybe we can also change the emmet generated output.
But now I will start to smash this bug 😀

@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

I need your opinion.
Would you like it if this plugin can turn that into pug-code or should the text-html remain untouched?

So this

<!DOCTYPE html>

could become this

doctype html
@JounQin

This comment has been minimized.

Copy link
Contributor Author

@JounQin JounQin commented Oct 5, 2019

I'd love to use doctype html which seems more consistent.

@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

Ok, then I will rebuild it so that it will be transformed to pug

@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

Ok, in this first iteration, I'm just going to transform singleline text-html,
because I have to track wrapping tags and really need to do a lot more things ^^'

So this would be another Issue

@JounQin

This comment has been minimized.

Copy link
Contributor Author

@JounQin JounQin commented Oct 5, 2019

@Shinigami92 Thx for fixing this. I think we could use angular-html-parser which should be available in prettier parsers in this case rather than trying to implement parse again which could be buggy and inconsistent with prettier's built-in html behavior.

@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

Released as 1.0.4
Thanks for using my Plugin 😃

Ok, thanks for mentioning, I will open a new issue and then I will enjoy my weekend 😋

@JounQin

This comment has been minimized.

Copy link
Contributor Author

@JounQin JounQin commented Oct 5, 2019

Happy weekend.

@Shinigami92

This comment has been minimized.

Copy link
Member

@Shinigami92 Shinigami92 commented Oct 5, 2019

Created an Issue to find the right place of the emmet abbrevation html:5
microsoft/vscode#81993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.