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 PHP in markdown #3123

Closed
mhlinder opened this issue Sep 20, 2016 · 9 comments
Closed

Raw PHP in markdown #3123

mhlinder opened this issue Sep 20, 2016 · 9 comments

Comments

@mhlinder
Copy link

I am trying to inject some php into an otherwise-static page, but --parse-raw and markdown_in_html_blocks do not directly address this, and indeed nor do they resolve it:

$ echo '<?php echo 1; ?>' | pandoc -f markdown -t html
<?php echo 1; ?>
$ echo '<?php echo "1"; ?>' | pandoc -f markdown -t html
<p>&lt;?php echo &quot;1&quot;; ?&gt;</p>

What seems to break this is the inclusion of quotes—which is necessary for, eg, a call to include.

@mhlinder
Copy link
Author

mhlinder commented Sep 21, 2016

This issue boils down to:

--parse-raw will mistake raw PHP containing no quotation marks for valid-but-untranslateable HTML. But raw PHP containing double quotes is correctly flagged as invalid HTML, so that it is treated as literal text that contains substitute HTML entities for raw characters like >, <.

Short of implementing a separate writer for PHP, one fix would be the option to write invalid HTML by disabling conversion to entities (see also, eg, Issue 2410).

@jgm
Copy link
Owner

jgm commented Sep 21, 2016

Can you give a short example?
Also, what version of pandoc are you using?

+++ M. Henry Linder [Sep 20 16 19:05 ]:

This issue boils down to:

--parse-raw will mistake raw PHP containing no quotation marks for
valid-but-untranslateable HTML. But raw PHP containing double quotes is
correctly flagged as invalid HTML, so that it is treated as literal
text that must substitute HTML entities for raw characters like &, >,
<.

Short of implementing a separate writer for PHP, one fix would be the
option to write invalid HTML by disabling conversion to entities (see
also, eg, [1]Issue 2756).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, [2]view it on GitHub, or [3]mute the
thread.

References

  1. Incosistent conversion of HTML entities #2756
  2. Raw PHP in markdown #3123 (comment)
  3. https://github.com/notifications/unsubscribe-auth/AAAL5G23H072JyIGv82x7JVlx1WbeZqEks5qsJEHgaJpZM4KB7d6

@jgm
Copy link
Owner

jgm commented Sep 21, 2016

Sorry, I see the example now (reading mail backwards).

@jgm
Copy link
Owner

jgm commented Sep 21, 2016

I think that this is fixed in the most recent version of pandoc.

% echo '<?php echo "1"; ?>' | pandoc 
<?php echo "1"; ?>

@jgm jgm closed this as completed Sep 21, 2016
@mhlinder
Copy link
Author

Right on, that was it...thanks

@mhlinder
Copy link
Author

Hi,

This issue was resolved because at the time, I had been running an old version of pandoc.

It appears this has broken again, could we please reopen this issue?

@jgm
Copy link
Owner

jgm commented Oct 11, 2018

This seems to have broken some time between 1.19.2.1 (works) and 2.0.6 (doesn't work).
Need to look at the 2.0 changelog for changes that might have broken this.
It could also have something to do with changes to the tagsoup library we compile against.

@jgm jgm reopened this Oct 11, 2018
jgm added a commit that referenced this issue Oct 11, 2018
…tions.

Fixes regression #3123 (since 2.0). Added regression test.
@jgm
Copy link
Owner

jgm commented Oct 11, 2018

Fixed.

@jgm jgm closed this as completed Oct 11, 2018
@mhlinder
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants