Skip to content

Fix/add compatibility with attr_list extension ids, classes #9

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

Open
wants to merge 7 commits into
base: major-refactor
Choose a base branch
from

Conversation

hendrikp
Copy link

@hendrikp hendrikp commented Mar 4, 2023

This fixes/adds the compatibility to supply custom anchor id, and class through the markdown text (through attr_list extension).

  • I also fixed the readme in regard how generic caption (Listings) are html rendered.
  • generic captions had a html-syntax errors previously in closing tag (contained class=listing statically)
    • this is fixed now

In regard to usage please see updated readme + unit tests.

Goal is to be able to be able to specify permalink / anchorid's to the resulting captions/elements in general through the attr_list extension. If no markdown attr_list specified the caption extension will still fallback to the previous id generation method.

hendrikp added 7 commits March 4, 2023 21:22
…ion extension (don't overwrite id supplied from attr_list, and if present extend class)
…on id, classes to table content element (otherwise lost).

this is not needed for image caption as, the attr_list for images is part of the image itself (this is not possible for tables by default)
…tag, this produced wrong html syntax (class in closing tag), and prevented applying a custom class)
@kyzyl
Copy link

kyzyl commented May 9, 2023

Hi! Is this PR waiting on something? I was just considering adding something like this myself.

This is a great plugin, and this functionality would be very helpful to allow for automatic in-text cross referencing. I'm sure many people would appreciate it.

@hendrikp
Copy link
Author

hm idk either, im using it from my branch for now - feel free todo the same. (install in pip through git source)

https://github.com/hendrikp/caption/tree/new-config-options-match-skip

@kyzyl
Copy link

kyzyl commented May 10, 2023

Yep, me too. Thanks :) I hacked in some javascript to do automatic cross-referencing as well. It just replaces the <ref>{#fig-blah}</ref> tokens in text with the appropriate auto-numbered "Figure 1" etc. that is associated with the referenced ID. Can also add links to the IDs as well so readers can just jump straight to it. This way it works essentially the same as in LaTeX.

Of course this would probably be better done in the actual plugin source rather than hacking the DOM after the fact, but I didn't want to figure out how it works for now.

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

Successfully merging this pull request may close these issues.

2 participants