-
Notifications
You must be signed in to change notification settings - Fork 237
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
Allow pod to give syntax highlighting hints for code blocks #605
Comments
From the Perl documentation: Verbatim Paragraph There's nothing in verbatim paragraphs which has to be Perl code, so it shouldn't really be formatted as Perl code. The bug is really that metacpan or its underlying modules makes the assumption that "verbatim paragraph = Perl code" and colours it up as such. |
For what it's worth, in the latest release of TOBYINK::Pod::HTML I use:
The reason for using a key-value pair is that it allows other hints to be passed to the highlighter too. For example:
|
Moved to wish list: https://github.com/CPAN-API/cpan-api/wiki/Wishlist |
After a conversation with @rjbs, I'm re-opening this. Might be a good task for a student. @rwstauner do you have any advice for how to implement this? |
At the moment I don't have a better suggestion than @tobyink's: The It's not ideal, but I'm not aware of anything better that Pod provides so while it may not be "elegant" it is fairly clever. The only other thing I can think of is to add a marker to the verbatim blocks (like |
The |
FWIW, some of my modules have started using I use it mainly for rendering a nice README.md for github, but it would be cool if metacpan DTRT, too. |
I think that the front end code will handle this already. The API will need to start using something like Pod::Simple::XHTML::WithHighlightConfig. I should make some changes to that module before integrating it though. |
It would be nice to be able to provide hints for syntax highlighting a given code block.
For example, executables often have a SYNOPSIS section that doesn't have Perl code in it like a library does, but instead has example command line invocations or a specification of the options and arguments the script accepts. That shouldn't be highlighted as though it were Perl code - it probably shouldn't by highlighted at all.
Similarly, some modules have ASCII art in code blocks to illustrate a data structure, for example. That shouldn't be highlighted either.
And some modules might (heaven forbid) include code blocks in a language other than Perl. It might be nice to provide a hint that "this block is actually Python".
Presumably this would use a
=for
but I leave it up to others to decide whether this is something that should be metacpan-specific (which might give us=for metacpan txt
), or something more generally to do with syntax highlighting (which might give us=for syntax_highlighting txt
).The text was updated successfully, but these errors were encountered: