pandoc-include-code icon indicating copy to clipboard operation
pandoc-include-code copied to clipboard

Include fails in nested environment

Open aubertc opened this issue 4 years ago • 5 comments

Imagine we have a test_pandoc.md file.

Then the following:

Here is some code:

```{.md include=test_pandoc.md}
```

Description environment.
~ 
    I'm in an environment.
    
    ```{include=test_pandoc.md}
    ```

    Hi!
    
    
- List
- Item

    ```{include=test_pandoc.md}
    ```

successfully insert the first time, but not the other two times. It seems like this is a regression, I believe it used to work properly not so long ago.

This is with pandoc-include-code-1.5.0.0, and I've tried with pandoc 2.11.0.4 up to pandoc 2.11.3.2-1 and still always have the same bug.

The first inclusion gives something (like)

<div class="sourceCode" id="cb1"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>I&#39;m a test for pandoc. </span></code></pre></div>

while the other gives something (like)

<div class="sourceCode" id="cb3" data-include="test_pandoc.md"><pre class="sourceCode md"><code class="sourceCode markdown"></code></pre></div>

Somehow, instead of been included, the code becomes a data-include value?

aubertc avatar Jan 22 '21 18:01 aubertc

Did you ever find a fix for this?

CameronDevine avatar Jan 04 '23 11:01 CameronDevine

No.

I have switched to pandoc-include, which provides similar functionality but has been more recently updated (Feb 16, 2022 Vs. Jun 16, 2021 for pandoc-include-code), and does not suffer from this particular bug (it has other downsides, that being said).

aubertc avatar Jan 04 '23 18:01 aubertc

I have created a branch in my fork where pandoc-include-code works in a nested environent.

https://github.com/rtc-book/pandoc-include-code/tree/nested

Feel free to use it if you would like.

CameronDevine avatar Jan 13 '23 22:01 CameronDevine

@CameronDevine I wonder of @owickstrom would be open to a PR?

ricopicone avatar Jan 13 '23 22:01 ricopicone

Not the way I got it working. I checked out an old commit, wiping away a couple of years of work, then removed some restrictions on the dependencies as @phillord had done.

CameronDevine avatar Jan 13 '23 23:01 CameronDevine