HIghlight source code in document?


As developper writing some article with fiduswriter, i need source code block with highlighting in my document.

Actually i don’t see this feature on menu bar, is it planned ?

Best regards,

Hey @reyman ,
that sounds like a difficult task - but not impossible. Showing code correctly is one requirement, highlighting text another. Have you checked whether Fidus Writer fulfills all your other requirements? If you are a programmer writing very programming centric text and don’t have difficulty writing LaTeX or markdown and you for example need things like code formatting that depends on the language that is being used and the output will end up on the web… Then Fidus Writer might not be the best tool for you as there are so many great web-centric text editors that can style Python code correctly, etc. . If you do write a book and you do need WYSIWYG tools and some of the other things Fidus Writer offers, then it might make sense to think about how to add something like highlighting as a feature.

Yes, you’re right @johanneswilm , as a programmer i don’t have difficulties to write latex or others. But … i also write publications with lot of non programmers. I’m starting to use fiduwriter in this use case, writing a paper about webscraping with non technical authors (jurist, etc.)

This is probably a niche for some users, but a WYSIWIG or simple md editors, open source, which manage and export correctly citations, similar to google doc for collaborative work, there are really few tools available. You have stylo (which highlight code with markdown + pandoc export / https://ecrituresnumeriques.ca/fr/2016/1/14/Stylo ) , codimd.io (markdown), and fiduswriter …

I hesitate between stylo and fiduswriter, both are some advantages and inconvenient.

If Fidus is python django backend, there are already some great highlighting lib like the venerable pygments no ?

Hey @reyman,
sorry for the late reply. Fidus Writer uses Python only on the server for serving the site, managing access rights, etc. . The Python code doesn’t touch the contexts of documents and doesn’t understand any of it either. Exports are done entirely in JavaScript. So unfortunately we cannot make use of any such Python library when it comes to document contents.