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

notebook figure rendering and pandoc-fignos #7

Open
amichuda opened this issue Aug 2, 2019 · 6 comments
Open

notebook figure rendering and pandoc-fignos #7

amichuda opened this issue Aug 2, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@amichuda
Copy link

amichuda commented Aug 2, 2019

With the addition of Jupyter kernels and showing plots directly from executed code, would there be some way to integrate codebraid with pandoc-fignos so that there could be figure captions in the resulting text?

@gpoore gpoore mentioned this issue Aug 2, 2019
@gpoore gpoore added the enhancement New feature or request label Aug 3, 2019
@gpoore
Copy link
Owner

gpoore commented Aug 5, 2019

It looks like pandoc-fignos needs images with (1) alt text and (2) an id starting with "fig:". I'm planning to add support for setting image attributes for rich output like plots that is included automatically. As soon as that is added, pandoc-fignos should function normally by running codebraid with --filter.

One of the main things I have to determine is the syntax to use for setting image attributes. I will probably add code block options like fig.caption, fig.id, fig.width, etc., possibly also with something like fig.pandoc_attr to allow things like {#id .class key=value} to be entered directly. I'm still thinking about how to handle the case of multiple images created by a single code block, since Pandoc's attribute syntax doesn't directly support data structures like lists or dicts. I'm thinking about something like fig.caption1, fig.caption2, and so forth for that case. Do you have any thoughts about that?

The syntax for figures will also need to support subfigures. At the moment, pandoc-fignos doesn't support subfigures (tomduck/pandoc-fignos#50), but I'm sure that it or another filter will support them in the future. In that case, I'm thinking about something like fig.caption along with fig.subcaption1, fig.subcaption2, etc.

@amichuda
Copy link
Author

amichuda commented Aug 8, 2019

Thanks so much for the reply. I think you're on the right track with that. It actually reminds me a little of the pweave approach to setting figure captions. Is that what you're going for?

I'm planning to add support for setting image attributes for rich output like plots that is included automatically. As soon as that is added, pandoc-fignos should function normally by running codebraid with --filter.

What would that look like? Would fig.caption become the alt-text in pandoc-fignos? Or would your approach make pandoc-fignos redundant?

I'm thinking about something like fig.caption1, fig.caption2, and so forth for that case. Do you have any thoughts about that?

I'm not an expert in pandoc attribute syntax, and googling it has proven to be a kind of difficult. Is there a reference for documentation on how that's set up? I'm sure you know better than me, but what if all caption titles were put in some long comma-separated string that you would parse through? I don't think that's a very elegant solution, but that's the only one coming to mind to me.

@amichuda
Copy link
Author

Hi! I wanted to see if you've had any new ideas or thoughts on this issue.

Again, thank you for the package, it's really helping me out with my thesis and writing up slides for a class I'm teaching!

@gpoore
Copy link
Owner

gpoore commented Aug 28, 2019

I haven't had any new thoughts. I think I'm going to try fig.caption when there is one figure, fig.caption1 and fig.caption2 and so on for multiple figures, and then fig.caption plus fig.subcaption1 etc. for creating one figure with subfigures. These would become alt-text for images, so this would make things compatible with pandoc-fignos. It might be worth adding built-in features like pandoc-fignos eventually, but I want to keep things as simple as possible for now. The main issue right now is a shortage of time for actually programming this.

In terms of a reference for Pandoc attribute syntax, https://pandoc.org/MANUAL.html and then searching for "attribute" is a good place to start. I've also looked at the Pandoc implementation several times to figure out exactly how attributes are defined.

@amichuda
Copy link
Author

amichuda commented Mar 1, 2021

I know this is a stale issue, but any plans to add this feature to codebraid in the near future?

@gpoore
Copy link
Owner

gpoore commented Mar 1, 2021

Unfortunately I can't give any specific estimates on new features. I am currently trying to release new versions of all my major open-source projects to catch up for the last year or so. As soon as that is done, I'm hoping to be able to focus on resolving all existing Codebraid issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants