Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Embedding source code
CharlesW
New
Hello,
We created a Vanilla forum for our technology, and developers want to be able to paste in source code (a mix of XML and JavaScript).
Apologies for what seems like a very simple question, but I looked for some time and wasn't able to find the answer: How does one paste in, say, XML and have that appear as entered? More than "pre", I need something that maintains the formatting exactly as entered.
— Charles
0
Comments
quick question - you don't want users to attach file uploads? which may be a way around the issue.
and I'm not sure if the geshi plugin helps.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
grep is your friend.
with markdown you should be able to encase in
~~~
grep is your friend.
also indent of four spaces
grep is your friend.
A good workaround, thanks. We could also post links to GitHub gists, but the engineering team thinks it's probaby better to have the code inline.
— Charles
Cooool! This answer had me stumped me for a while, but I finally figured out that it would work once I changed my config's InputFormatter like so:
Thank you!
Sorry, I don't understand. Mind elaborating a bit?
Also: Even though we're now using the Markdown InputFormatter, could we write a custom plug-in (or extend a current one) to support the mixed XML/JavaScript source?
— Charles
.four spaces in front of all lines is equivalent to
~~~
(four space indent).http://daringfireball.net/projects/markdown/syntax
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Yes you can write a pre-formter plugin that would change to offend charaters to html entities, then it would go through the Markdown, HTML formatters. Or you can do some javascript post formating. Markdown is also HTML compatable (filtered by HTMLawed).
However, in fact the pre behavior is actually correct. pre in itself doesn't render html entities as literal in the client, and HTMLawed is generally faithful to HTML.
The html literal would rendering would be in a textarea, you could use jquery to get a "raw" .text() version of the rendering to put in a textarea.
Whatever you want to do.
grep is your friend.