-
Notifications
You must be signed in to change notification settings - Fork 13
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
Generation of HTML documents with custom CSS #13
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I don’t know this feature of pandoc well. Can multiple css files also be provided?
Nevertheless, I put together an additional CSS file and included it as follows: But generating a stand-alone HTML file using: |
Interesting. Maybe I'll poke around for some pandoc projects and see their approach to css with regard to theming. If it has to be one file in the end, I guess you could always do something like pull in https://github.com/bazelbuild/rules_sass and build out the file using sass. And maybe the same approach with making it interactive with js? |
At this moment in time, I'm not actively developing new features for bazel-pandoc myself. Nevertheless, your thoughts on this are interesting and are could be of some real added value to bazel-pandoc :) May I ask what you are using bazel-pandoc for? Since interactive JS is something your could call out of the ordinary for just a tool which converts - for example - documentation from markdown to HTML. When you are thinking about using interactive JS I would rather consider developing a stand-alone website from the beginning, instead of using pandoc. |
I just tried out the changes and it works great. The only thing that stands out is the need to wrap the css in a style tag. Other examples I've found don't seem to require this: https://benjam.info/panam/, but maybe they were written against an older version of pandoc? |
Hi sorry I'm kind of a github noob so I'm not sure it's the best way, but I created #16 which deals with the issue of the CSS file not being copied over, and adds a "data" attribute to solve the issue with other media like images that can be referenced from the generated document and need to be copied over. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to use ctx.expand_location instead of forcing an option?
https://docs.bazel.build/versions/master/skylark/lib/ctx.html#expand_location
As requested in an issue, this PR implements the ability to generate HTML documents with custom CSS defined in a separate stylesheet.
The output can be reproduced by running:
bazel build @bazel_pandoc//sample/...
Known limitations (a.k.a. improvements which could be implemented before merging with master):
to_format
is specified in your rule. This limitation was added because otherwise the--css
-flag is also appended for non-HTML files. This results in an error for some conversions. In fact, this limitation could be resolved by using `-c' instead, but then the CSS is somehow not included.-s
could be added, but thenbazel-pandoc
should also output the CSS file itself.