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

Add prepend arg to toc extra (#397) #568

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

Crozzers
Copy link
Contributor

This PR closes #397 by adding a flag that enables the TOC to be prepended to the output text.

markdown2.markdown(text, extras={'toc': {'prepend': True}})

This option is off by default to maintain backward compatibility

@nicholasserra
Copy link
Collaborator

Don't we do this somewhere else also? Maybe for some table extra. This is giving me deja vu

@Crozzers Crozzers mentioned this pull request Feb 21, 2024
@Crozzers
Copy link
Contributor Author

Can't think of anywhere else we do this. The only recent changes to TOC I can think of is with mixed header-ids where we sort the TOC by order of appearance. Only other place that toc is outputted seems to be in the CLI

if extras and "toc" in extras:
log.debug("toc_html: " +
str(html.toc_html.encode(sys.stdout.encoding or "utf-8", 'xmlcharrefreplace')))

@nicholasserra
Copy link
Collaborator

Yup, I'm remembering adding support to the CLI output here

#283

@nicholasserra
Copy link
Collaborator

Needs a rebase or merge in

@Crozzers
Copy link
Contributor Author

Rebased onto master

@nicholasserra nicholasserra merged commit 646e6d2 into trentm:master Feb 28, 2024
18 checks passed
@nicholasserra
Copy link
Collaborator

Thanks!

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.

TOC not displayed when not in CLI
2 participants