How do I get syntax highlighting when using HTML as source in Pelican? - pygments

I recently started using the pelican cms, and I prefer to write my articles in HTML, as opposed to rst or markdown. Thats's fine. Pelican lets me do that.
But I can't seem to find any way to specify the language for <pre> blocks so Pelican will run it through Pygments to generate syntax higlighting.
The documentation only specifies how to do this with markdown or rst.

That's because pelican itself doesn't use Pygments directly. It's applied through md and rst processors. As for HTML contents, pelican doesn't do anything except extracting the metadata from it. It's probably easier to use something like highlight.js.

Related

Netbeans: Syntax Highlighting -- multiple languages per file

The majority of the pages I author contain both HTML and PHP. It would appear that in Netbeans you can have syntax highlighting for one or the other by setting the associated file types.
Coming from Notepad++, I've always taken for granted the fact that I could use php, css, html, javascript all in one file and retain syntax highlighting for all of them.
Is this possible in Netbeans?
I think the answer here is that Netbeans DOES support multiple language, but it will only get it right if there's something hinting at the "inner" language. When I exit PHP with ?> NetBeans tends to format what comes before the next <?php as HTML automatically. Not sure if that is working for you. Maybe you were trying to get highlighting in a string like $output = "<some><html";. I think you can imagine why that second one wouldn't work.
For JS, for example, it seems to look for the <script type="text/javascript">, and stuff inside gets the JS highlighting even if the file type is PHP.
This other question has a great solution for "tricking" Netbeans into rendering your JS output by PHP into being formatted, even when your code doesn't have a <script type="text/javascript"> tag.

How to custom ejs delimeters in harpjs?

harp js seems to be a very useful tool to me.
they suppor ejs compile,but, I didn't find how to get the ejs custom delimiters function support.
I want to replace <% %> with new tokens such as {{}}.
This hasn’t been made configurable within Harp, sorry. We do our best to set useful defaults rather than making everything configurable, so you don’t have to worry about setting things up. It also means that boilerplates, docs, and blog posts will still be relevant for anyone using EJS.
If it’s really necessary for your particular project, and you would still like to use Harp, you could fork Terraform (Harp’s pre-processing engine) and modify the settings, but personally I would recommend just using the default delimiters.

How to write code documentation in Typo3 6.x?

We need to write a complex documentation of the API use in Typo3 6.x, but entering the code samples through RTE is very error-prone, and using just HTML element defeats the purpose of CMS.
Is there any way for nice (for editors) entering of text wrapped around code samples in various programming languages, for Typo3?
Another alternative is to use the extensions restdoc (for display) and sphinx (for generation) to make use of restructured text to write the documentation the same way the documentation of TYPO3 is created.
You could try to use Markdown content elements. I've never tried it, but there is an extension for it (markdown_content_reloaded).

dealing with itextsharp XMLWorkerHelper.ParseXHTML strict behavior

While trying to use XMLWorkerHelper.GetInstance().ParseXHTML() i find that it is really strict. Any wrong order of tags or unclosed tags will cause it to throw exception.
I am converting HTML that I have no control over.
Are there any flags to make it less strict? An input callback interface to handle funny markup? Anything in the itextsharp.tools.xml.html? Or an entirely new library compatible with itextsharp.text.IElement?
The name of the class and that method pretty much sums it up - you can't. The entire pipeline is based on the assumption that a valid XML document will be passed in, everything else will throw an exception. You can customize the pipeline and add your own handlers for things like link resolution, custom CSS properties and new HTML tags, but the core document processor still needs valid HTML.
I would recommend looking into running your HTML through a library that can convert it to XHTML.
EDIT
Also check out wkhtmltopdf. It uses webkit to render HTML and does (apparently) a pretty good job.
How to use wkhtmltopdf.exe in ASP.net
wkhtmltopdf.exe System.Security.SecurityException on cloud web server. How can i override server security policy
C# html to pdf converter using wkhtmltopdf or any other free tools

Sanitizing title URLs in ExpressionEngine 1.6.x

I run a blog where the blog title is either an external link or an internal link to a longer piece similar to what you’ve seen on similar blogs. For some reason, ExpressionEngine (1.6.x) does nothing to sanitize such things as ampersands in the URLs provided.
I use Markdown in the body text, which seems to do a great job of sanitizing all URLs. Yet, ExpressionEngine’s own handling of the titles doesn’t cut it. I have tried formatting the “title URLs” in Markdown and failed miserable, and damn if I know what the hell it is in ExpressionEngine that prevents me from using it.
So the question boils down to what other ExpressionEngine 1.6.x users do and have done, or whether someone can come up with a MacGyver-esque solution. Because I’ve been stumped upwards of half a year.
The XML Encode Plugin for EE1 from Rick Ellis of EllisLab will convert your special characters to HTML entities.
The plugin was originally designed to convert reserved XML characters to HTML entities in the ExpressionEngine RSS templates, but should work for what you need.
To use the plugin, wrap your {title_link} custom field in between its tag pairs:
{exp:xml_encode}
{title_link}
{/exp:xml_encode}
This would result in:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Being converting into:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Other EE1 Plugins which offer more similar but advanced features are Cleaner by utilitEEs (Oliver Heine) or Low Replace by Lodewijk Schutte.