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 basic toc generation for pandoc #8911

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

pagdot
Copy link

@pagdot pagdot commented Aug 21, 2021

As requested in #8152

I've pretty much copied the toc parser code from asciidocext and modified it where necessary.

For toc generation with pandoc to work, I have to generate a standalone document.

This lead to a few (solved) issues:

  • added CSS causing issues: Solved by extracting <body> and ignoring everything else
  • pandoc complains about missing title metadata: Solved by providing dummy title on commandline

@CLAassistant
Copy link

CLAassistant commented Aug 21, 2021

CLA assistant check
All committers have signed the CLA.

@pagdot pagdot marked this pull request as draft August 21, 2021 11:56
@pagdot pagdot marked this pull request as ready for review August 21, 2021 14:06
Copy link

@BenSYZ BenSYZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: lstrim rstrim number, use --quiet

Unlike asciidocext, the only thing left is the <body> tag, which comes from the extracted body node in the first f of extractTOC (by @pagdot).

With --quiet, pandoc only suppress warning messages, not error message. So there is no need not to use --quiet.

markup/pandoc/convert.go Show resolved Hide resolved
markup/pandoc/convert.go Outdated Show resolved Hide resolved
@BenSYZ BenSYZ mentioned this pull request Oct 26, 2021
@MilkClouds
Copy link

Is this issue completed? Is there anything remaining to implement? Will it be merged?

@bep
Copy link
Member

bep commented Apr 27, 2022

Sorry for the delay, I'm not a Pandoc user and this has not been on top of my priority list.

The code looks good, but we need a test.

Since this PR was started I created a new integration test harness that allows integration tests to run full site builds from the package they live in (e.g. the pandoc package). Look for hugolib.NewIntegrationTest in the master branch.

@nealkruis
Copy link

Eagerly waiting for this feature. @pagdot any updates?

@pagdot
Copy link
Author

pagdot commented Oct 6, 2022

rebased on the current master and added a very basic integration test. I'd like to verify that toc extractions work in a test, but don't really know how

@pagdot pagdot marked this pull request as draft October 6, 2022 17:21
@pagdot pagdot marked this pull request as ready for review October 6, 2022 17:21
@github-actions
Copy link

github-actions bot commented Oct 7, 2023

This PR has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
Please check https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#code-contribution and verify that this code contribution fits with the description. If yes, tell is in a comment.
This PR will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label Oct 7, 2023
@pagdot
Copy link
Author

pagdot commented Oct 9, 2023

@bep Does this look good to you or is still anything missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants