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

page hook: page.content is a string, not a list of parsed sections #4

Open
bguiz opened this issue May 24, 2014 · 2 comments
Open

page hook: page.content is a string, not a list of parsed sections #4

bguiz opened this issue May 24, 2014 · 2 comments

Comments

@bguiz
Copy link

bguiz commented May 24, 2014

hook.page claims that:

        // page.content is a list of parsed sections

See; https://github.com/GitbookIO/plugin/blob/master/index.js#L59

However, this is not the case - page.content really is just a string containing the markdown for the currently processed input file; which makes the page hook no different from the page:before hook. When implementing a plugin, add the following statement to each of the hooks to verify.

        console.log('typeof page.content:', (typeof page.content));
@bguiz
Copy link
Author

bguiz commented May 24, 2014

The use case that I am trying to satisfy is a means to add HTML fragments to the page after the markdown has been processed.

This can currently be achieved using the book.html.body:end hook:

GitbookIO/plugin-ga@f48257e#diff-168726dbe96b3ce427e7fedce31bb0bcR8

... except that I would like to insert within each page content (not at the close of the body tag, as they will not not visible).
Within <div class="page-inner"> would be great.

@bguiz
Copy link
Author

bguiz commented May 24, 2014

I have managed to work around it in the plugin I was creating:

https://github.com/bguiz/gitbook-plugin-share

... so you can de-prioritise this 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

No branches or pull requests

1 participant