Skip to content

Two raw HTML blocks without blank lines between #830

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

Closed
balupton opened this issue Jun 5, 2019 · 5 comments
Closed

Two raw HTML blocks without blank lines between #830

balupton opened this issue Jun 5, 2019 · 5 comments
Labels
bug Bug report. confirmed Confirmed bug report or approved feature request. core Related to the core parser code.

Comments

@balupton
Copy link

balupton commented Jun 5, 2019

Given:

The command-line client ships alongside the daemon. Usage information for all commands, including sub-commands, is available via the --help flag.

<style>pre { background: inherit !important; word-wrap: inherit !important;  white-space: pre-wrap !important; }</style>

## textile [&lt;flags&gt;]

<p><pre>Textile is a set of tools and trust-less infrastructure for building censorship resistant and privacy preserving applications</pre></p>
<table>
	<tr><th>Flag</th><th>Description</th></tr>
	<tr><td><code>--help</code></td><td><pre>Show context-sensitive help (also try --help-long and --help-man).</pre></td></tr>
	<tr><td><code>--help-long</code></td><td><pre>Generate long help.</pre></td></tr>
	<tr><td><code>--help-man</code></td><td><pre>Generate a man page.</pre></td></tr>
	<tr><td><code>--completion-bash</code></td><td><pre>Output possible completions for the given args.</pre></td></tr>
	<tr><td><code>--completion-script-bash</code></td><td><pre>Generate completion script for bash.</pre></td></tr>
	<tr><td><code>--completion-script-zsh</code></td><td><pre>Generate completion script for ZSH.</pre></td></tr>
	<tr><td><code>--api=&#34;http://127.0.0.1:40600&#34;</code></td><td><pre>API Address to use</pre></td></tr>
	<tr><td><code>--api-version=&#34;v0&#34;</code></td><td><pre>API version to use</pre></td></tr>
	<tr><td><code>--debug</code></td><td><pre>Set the logging level to debug</pre></td></tr>
</table>

## textile help [&lt;command&gt;]

<p><pre>Show help.</pre></p>
<table>
	<tr><th>Argument</th><th>Description</th></tr>
	<tr><td><code>[&lt;command&gt;]</code></td><td><pre>Show help on command.</pre></td></tr>
</table>

## textile account

<p><pre>Manage a wallet account</pre></p>

The latter two headers are not converted to h elements. If one changes it to:

The command-line client ships alongside the daemon. Usage information for all commands, including sub-commands, is available via the --help flag.

<style>pre { background: inherit !important; word-wrap: inherit !important;  white-space: pre-wrap !important; }</style>

## textile [&lt;flags&gt;]

<p><pre>Textile is a set of tools and trust-less infrastructure for building censorship resistant and privacy preserving applications</pre></p>
<table>
	<tr><th>Flag</th><th>Description</th></tr>
	<tr><td><code>--help</code></td><td><pre>Show context-sensitive help (also try --help-long and --help-man).</pre></td></tr>
	<tr><td><code>--help-long</code></td><td><pre>Generate long help.</pre></td></tr>
	<tr><td><code>--help-man</code></td><td><pre>Generate a man page.</pre></td></tr>
	<tr><td><code>--completion-bash</code></td><td><pre>Output possible completions for the given args.</pre></td></tr>
	<tr><td><code>--completion-script-bash</code></td><td><pre>Generate completion script for bash.</pre></td></tr>
	<tr><td><code>--completion-script-zsh</code></td><td><pre>Generate completion script for ZSH.</pre></td></tr>
	<tr><td><code>--api=&#34;http://127.0.0.1:40600&#34;</code></td><td><pre>API Address to use</pre></td></tr>
	<tr><td><code>--api-version=&#34;v0&#34;</code></td><td><pre>API version to use</pre></td></tr>
	<tr><td><code>--debug</code></td><td><pre>Set the logging level to debug</pre></td></tr>
</table>

<p></p>

## textile help [&lt;command&gt;]

<p><pre>Show help.</pre></p>
<table>
	<tr><th>Argument</th><th>Description</th></tr>
	<tr><td><code>[&lt;command&gt;]</code></td><td><pre>Show help on command.</pre></td></tr>
</table>

<p></p>

## textile account

<p><pre>Manage a wallet account</pre></p>

Then they are.

balupton added a commit to textileio/community that referenced this issue Jun 5, 2019
closes #88

- moves from makefile to bash scripts (would use npm scripts, but seems textile tries to avoid that), as makefile does not support what is necessary for the build script

- there is no TOC for the CLI page due to these bugs:

    Python-Markdown/markdown#830

    Python-Markdown/markdown#829

- adds the editorconfig from textileio/base

Signed-off-by: Benjamin Lupton <[email protected]>
@waylan
Copy link
Member

waylan commented Jun 5, 2019

Thanks for the report. This is a weird one. It appears that the raw HTML parser is failing to find the end of the raw HTML block and consuming the rest of the document. Here is the minimum example I found which exhibits the problem:

<p><pre>Raw HTML</pre></p>
<table></table>

## Header

The above results in this output:

<p><pre>Raw HTML</pre></p>
<table></table>

## Header

Note that this requires all of the following:

  1. The <p> must have a <pre> nested in it.
  2. There must be no blank line between the <p> and <table>.
  3. I tried a <p> element instead of a <table> and the problem did not persist. I did not try any other elements yet.
  4. The actual contents of the <table> seem to not matter, thus they are excluded in the above example.
  5. It does not matter if the <table> is on multiple lines or one line. The problem persists either way.

Given number 2 above, as a workaround, you can add a blank line between each of the your raw HTML block level elements (add a blank line between your <p> and <table> elements). This should not be surprising as the rules state that each block level raw HTML element must be surrounded by blank lines. However, in practice, all other implementations don't require the blank line so we shouldn't either. This is a bug.

Presumably we missed this bug as we most likely only ever tested with two <p> tags. We also likely did not tests with a <pre> nested in a <p>. Actually, I'm not sure, but is a <pre> tag even valid in a <p>? It is certainly unusual.

@waylan waylan added bug Bug report. confirmed Confirmed bug report or approved feature request. core Related to the core parser code. labels Jun 5, 2019
balupton added a commit to textileio/community that referenced this issue Jun 5, 2019
closes #88

- moves from makefile to bash scripts (would use npm scripts, but seems textile tries to avoid that), as makefile does not support what is necessary for the build script

- there is no TOC for the CLI page due to these bugs:

    Python-Markdown/markdown#830

    Python-Markdown/markdown#829

- adds the editorconfig from textileio/base

Signed-off-by: Benjamin Lupton <[email protected]>
balupton added a commit to textileio/community that referenced this issue Jun 5, 2019
closes #88

- moves from makefile to bash scripts (would use npm scripts, but seems textile tries to avoid that), as makefile does not support what is necessary for the build script

- there is no TOC for the CLI page due to these bugs:

    Python-Markdown/markdown#830

    Python-Markdown/markdown#829

- adds the editorconfig from textileio/base

Signed-off-by: Benjamin Lupton <[email protected]>
balupton added a commit to textileio/go-textile that referenced this issue Jul 4, 2019
`pre` tags inside `p` tags is invalid, and causes strict parsers to fail

/workaround for Python-Markdown/markdown#830

Signed-off-by: Benjamin Lupton <[email protected]>
balupton added a commit to textileio/community that referenced this issue Jul 4, 2019
- Workarounds Python-Markdown/markdown#830
- Closes #95
- References textileio/go-textile#847

Signed-off-by: Benjamin Lupton <[email protected]>
balupton added a commit to textileio/go-textile that referenced this issue Jul 4, 2019
* cli: docs: output valid html

`pre` tags inside `p` tags is invalid, and causes strict parsers to fail

/workaround for Python-Markdown/markdown#830

Signed-off-by: Benjamin Lupton <[email protected]>

* version: v0.6.1

Signed-off-by: Benjamin Lupton <[email protected]>
balupton added a commit to textileio/community that referenced this issue Jul 4, 2019
- Workarounds Python-Markdown/markdown#830
- Closes #95
- References textileio/go-textile#847

Signed-off-by: Benjamin Lupton <[email protected]>
@waylan waylan changed the title Headers aren't converted to h* elements if they are proceed from anything but p elements Two raw HTML blocks without blank lines between Nov 26, 2019
@waylan
Copy link
Member

waylan commented Jun 30, 2020

I have a suspicion that this could be related to #780. The result is different, but the tag counting alogarithm is wrong in both cases.

@facelessuser
Copy link
Collaborator

I suspect you are right...not looking forward to unraveling this 😬

@waylan
Copy link
Member

waylan commented Jul 1, 2020

This issue doesn't exist in #803. Of course, that is incomplete, but our efforts might be better utilized by finishing that than by addressing each of these individual edge cases in the existing code base.

@facelessuser
Copy link
Collaborator

That would honestly be my preferred route. Getting a nice clean implementation that is easier to debug would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report. confirmed Confirmed bug report or approved feature request. core Related to the core parser code.
Projects
None yet
Development

No branches or pull requests

3 participants