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

Fenced Code Block Identifiers not working for Latex or PDF output #1025

Closed
Vinai opened this issue Oct 17, 2013 · 1 comment
Closed

Fenced Code Block Identifiers not working for Latex or PDF output #1025

Vinai opened this issue Oct 17, 2013 · 1 comment

Comments

@Vinai
Copy link

Vinai commented Oct 17, 2013

I'm trying to link to identifiers for fenced code blocks. The input is pandoc markdown, output is a PDF file. The code block identifiers are not being created.

Test markdown to reproduce:

## Fenced Code
## Header with explicit identifier {#myhead}

~~~ {#php-code .php}
class Customergroup extends Data_Form_Element_Multiselect
{
    /**
     * @return int
     */
    public function getValue()
    {
        $value = $this->getData('value');
        if (!is_null($value) && !is_array($value)) {
            $value = explode(',', (string)$value);
        }
        if (empty($value)) {
            $value = array(Config::USE_DEFAULT);
        }

        return $value;
    }
}
\~~~

This is a link to the [PHP](#php-code). <== doesn't work  
This is a link to the [header](#fenced-php-code). <== works  
This is a link to the [sub-head](#myhead). <== works  

Please note, I had to break the closing ~~~ by prefixing a backslash, otherwise the github markdown parser would render the next 3 lines as plain html instead of as part of the code block. In the real markdown I'm using that \ is not present.

Here a link to the answer from fiddlosopher for my question on pandoc-discuss as reference:

https://groups.google.com/d/msg/pandoc-discuss/6_XWo3mkQOU/LYxYWOop_KAJ

I quote:

The ID attribute is set in HTML output.

Currently it doesn't do anything in LaTeX output. That could be changed -- presumably a hyperlink anchor could be set as with headers.

@nougad
Copy link

nougad commented Oct 17, 2013

If you compile with the --listings option it should be working (see #961 ). But without you're right. That is currently not working.

@jgm jgm closed this as completed in 6e1c24d Oct 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants