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

Problem with <cxx-example> within <p> block #7

Open
jaredhoberock opened this issue May 8, 2014 · 2 comments
Open

Problem with <cxx-example> within <p> block #7

jaredhoberock opened this issue May 8, 2014 · 2 comments
Labels

Comments

@jaredhoberock
Copy link
Contributor

I've noticed that placing <cxx-example> within a paragraph will cause the example to be closed immediately without surrounding the example text.

The following HTML should reproduce the bug. To workaround the issue, I close the <p> before using <cxx-example>, and it produces the output I expect.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"/>
  <script src="bower_components/platform/platform.js"></script>
  <link rel="import" href="bower_components/cxx-html-doc-framework/framework.html"/>
</head>
<body unresolved="">

<p>
<cxx-example><pre>
foo bar</pre>
</cxx-example>
</p>

</body>
</html>
@jyasskin
Copy link
Contributor

jyasskin commented May 8, 2014

@asutton added <cxx-codeblock> to somewhat handle this, but it'll probably break when it's published/flattened because the HTML parser "knows" when it needs to close the <p>. Would it make sense to just omit the <p> entirely, since <cxx-example> defaults to display:block? It looks like @slightlyoff's https://slightlyoff.github.io/ServiceWorker/spec/service_worker/, another spec using a similar system, is just avoiding nesting code samples inside paragraphs.

We've also mentioned defining a <cxx-p> element to use instead of <p> elements so that the HTML parser won't cause so many problems.

@jaredhoberock
Copy link
Contributor Author

Thanks @jyasskin. I'll just avoid nesting <cxx-example> within <p>. As long as the example doesn't receive a paragraph number it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants