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

output code in textile: &lt; shown, instead of desired < #3359

Open
ajneu opened this issue Jan 18, 2017 · 2 comments
Open

output code in textile: &lt; shown, instead of desired < #3359

ajneu opened this issue Jan 18, 2017 · 2 comments

Comments

@ajneu
Copy link

ajneu commented Jan 18, 2017

Hi!

The following bash snippet using pandoc:

markdown_text=$(cat <<EOF
\`\`\`cpp
int go()
{
    constexpr int min_ = std::numeric_limits<int>::min();

    int num;
    func1("asdf/qwer", 0, &num, min_); // call func1()
    return num;
}
\`\`\`
EOF
)

echo "$markdown_text" | pandoc -f markdown_github -t textile

ouputs the following in textile markup:

<pre class="cpp">
int go()
{
    constexpr int min_ = std::numeric_limits&lt;int&gt;::min();

    int num;
    func1(&quot;asdf/qwer&quot;, 0, &amp;num, min_); // call func1()
    return num;
}
</pre>

And if you take that textile-markup and paste into into the Redcloth textile tryout (Redcloth is used e.g. in Redmine), then it gets rendered incorrectly as:

int go()
{
    constexpr int min_ = std::numeric_limits&lt;int&gt;::min();

    int num;
    func1(&quot;asdf/qwer&quot;, 0, &amp;num, min_); // call func1()
    return num;
}

Correctly is should actually be:

int go()
{
    constexpr int min_ = std::numeric_limits<int>::min();

    int num;
    func1("asdf/qwer", 0, &num, min_); // call func1()
    return num;
}
@jgm
Copy link
Owner

jgm commented Jan 18, 2017

So what should the textile look like? I guess you're saying that the material between the pre tags in textile is not interpreted as HTML would be (since HTML would understand &amp; as an & etc.). But then what are the rules? What if you have a code block containing a literal </pre> tag, how would you handle that?

@ajneu
Copy link
Author

ajneu commented Jan 18, 2017

In Redcloth (http://redcloth.org/try-redcloth/)

the following markup

<pre class="cpp">
std::vector<int> vec;
   <pre>a = b;</pre >
</pre>

std::vector&#60;int&#62; vec;

renders to the following

std::vector<int> vec;
   <pre>a = b;</pre >

std::vector<int> vec;

With the first 2 lines being a code-block (inside pre). Note that inside the code-block I'm using
</pre > and not
</pre>

I don't know how to markup the 2nd one, inside a code-block.

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

3 participants