How to format markdown and all code in it? - formatting

I have a bunch of markdown files in my github repo. As there are many members in the team, the syntax of markdown and code in markdown files are hard to be standardised.
What I want is:
Create a github action that modify those files automatically when there is a push.
I can't find a markdown prettifier that format the code as well. (e.g. putting spaces around '=')
The solutions that I can think out of are:
Use a CLI tool that can do all the stuff
Use a tool for markdown, use a script to filter all code in it and parse it to anther tool
Send http requests to those online prettifier if such CLI tools do not exist
Note: I have Java, Cpp, Swift and more in my markdown.
Any solution for this? I will be appreciated if the script could be provided (if needed).
Thanks.

If those markdown files are located in a java project, you may try spotless.
For example, if you have a maven project, with spotless, just run mvn spotless:apply, it could fix all the styles / formatting issues of your markdown files automatically.

Related

Change options of already used latex package with doxygen

I'm using cmake with doxygen to generate documentation based on some markdown files. There are some special characters in those markdown files that I can't control (add by users and I just run my script). I found a solution by using the option utf8x instead of just utf8 with the inputenc package and use ucs package as well.
So, I added the following line into CMakeLists.txt file:
set(DOXYGEN_EXTRA_PACKAGES ucs "[utf8x]{inputenc}")
Which lead to having the following lines in refman.tex file:
% Packages requested by user
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
The problem is, there is already \usepackage[utf8]{inputenc} in the file which lead to an error on generating the pdf file using make pdf.
I can solve that by have a special bash/python script that replaces \usepackage[utf8]{inputenc} with whatever I want, but it seems strange to me that there is no way to make doxygen replaces/removes aready used packages as there is already EXTRA_PACKAGES which can be used to add extra packages.

How to proper integrate PrismJS into a Eleventy project?

I'm building a site using eleventy and want to include code examples with code-highlighting. Prism looks like a great choice for this. How would I add it proper to the build process (not as CDN)?
Use the download option. This gives you the JS/CSS you need. Copy it to your site and ensure you are using the "Passthrough File Copy" (https://www.11ty.dev/docs/copy/) option to copy CSS and JS files over.

Understanding PDFBox jar files

I am attempting to install PDFBox on my system in order to create PDF files, but am unsure which jar files I need. If I go to https://pdfbox.apache.org/download.cgi
I see command line tools as follows:
pdfbox-app (9.1MB)
preflight-app (9.2MB)
debugger-app (9.0MB)
I also see "Libraries of each subproject" as follows:
pdfbox (2.6MB)
fontbox (1.6MB)
preflight (248KB)
xmpbox (132KB)
pdfbox-tools (77KB)
pdfbox-debugger (245KB)
What is meant by "each subproject"? Is it talking about the command line tools or something different?
I am planning to use java from the command line rather than in an IDE. Does this mean that I just need the Command line tools or do I need the "Libraries of each Subproject" as well? What does the "-app" indicated in the command line tools vs the related libraries?
Is there a page on apache.org that mentions the differences between all of these?
To create PDF files should I be using the preflight and debugger files as well or are those optional?
Summarizing the comments: you want to create a PDF from scratch and access your development over ssh so you can't use an IDE and have to use javac. For that you could use pdfbox-app jar file, but this would be huge. Instead, use the pdfbox, fontbox and commons-log jar files. See also here for additional dependencies if you want to do more advanced stuff (read / render (= convert to image) / decrypt / sign).

WebStorm syntax highlighting for Swig template engine

Given:
The Swig template engine: http://paularmstrong.github.io/swig/
Webstorm has a plugin for it: Textmate bundles support
A Textmate bundle for Swig is available: https://github.com/paularmstrong/Swig.tmbundle
I expect I should be able to get Swig highlighting fixed, but I'm only getting half way.
Below is the resulted highlighting I get. The Swig code is highlighted as expected, but HTML is not highlighted anymore.
I've tried installing and enabling the HTML textmate bundle as well, but when both the HTML and the Swig bundle are activated, the code is highlighted as only HTML. If I disable the HTML bundle but have the Swig bundle still active, I only get Swig highlighting.
My Question: How do I get Swig code and HTML code highlighted in the same file in WebStorm on Windows?
Result:
This is my Textmate Bundles configuration in WebStorm 9:
Again, simply selecting the HTML bundle to enable it doesn't work.
Swig has nearly identical syntax to Twig, so we can assume they can be used interchangeably speaking of syntax highlighting and code completion.
The thing is that PHPStorm it has a Twig support throught a plugin (which is awesome BTW), but sadly it is not available in the others IDEs thought the Plugins menu.
This issue can be solved by:
manually downloading the plugin from the official repo at https://plugins.jetbrains.com/plugin/7303?pr=
then installing it manually thought the Plugin interface,
then or use the .twig extension on files or adding a new mapping in the File Types system menu for the type Twig, with wildcard *.html or *.swig, how you prefer.
I'm using the *.html workaround and work like a charm, both Swig & HTML syntax highlighting + code completion.
Hope this helps you like it did to me :)

PhantomJS/CasperJS IDE Helper

Is there any way to get IDE support for CasperJS functions? I am currently using PhpStorm, but also tried in netbeans, it won't know which functions are defined. It is quite irritating that I get Unresolved variable / undefined function IDE warnings for all the functions.
I tried to copy \casperjs\modules\*.js files to the project, most of the functions got "defined".
PhpStorm: Download the casperjs.zip from casperjs.org, it will contain a modules folder, copy every .js file to your project. (I put them in an IDE_HELPER folder)
An IDE helper javascript file would still be much better, but it is working.
Alternatively: You can also attach these files as external libraries, so it won't bother you while browsing your own files.
It should work in other IDEs too.
Disclaimer: I'm talking about JetBrains products.
I encountered this problem myself. The easiest way to solve it is to click on a bottom right icon (Finally, I understand that is this for!).
It will show you which libraries are associated with an open file. The only thing you have to do is to click on «Libraries in scope» and add your library by clicking «Download»
I know it's an old post, but after not finding any IDE Helper too I managed to write a script that creates one by scraping the content off of the official docs. You can find out more about the IDE Helper on my website:
http://christophersax.com/2016/casperjs-ide-helper/
(It's free of course)
I hope it helps!
You can add casperjs as a Resource in your Preferences.
Go to Project > Directories > + Add Content Root > Add casperjs folder then > Mark as Resource Root.