How to show markdown format text in tkinter? - python-3.x

In python-3.x with tkinter GUI, I developed a program with a regular simple window.
I want to show a markdown format string saved in a string called markdownText on program window:
markdownText='_italic_ or **bold**'
desired output is:
italic or bold
Is there any solution?

I was just searching for a similar solution, and it does indeed not seem like there is a default module/class/library for the combination of Python, TkInter and markdown. However a continued search revealed the following options:
Python-Markdown – This a module capable of parsing markdown into the following output formats: Python-Markdown can output documents in HTML4, XHTML and HTML5.
TkInter displaying html – As the linked answer indicates, Tkhtml can display html "pretty well", and it has a python wrapper
In other words, if you are willing to use an intermediate step of converting into html that might be a viable route for you to display markdown strings within a tkinter GUI.

Related

Produce HTML5 Output from CKEditor

I am using CKEditor 4.9.1 in my project. I want that CKEditor will produce HTML5 formatted output in place of HTML. Right now it is producing Font Tag and in table it is given the width and other attributes which is not supposed to be come in HTML5 output.Please help me out to find the solution for the same.

Programming printable 2d-graphics

I want to create parametric graphics that can be printed exactly on any printer:
setup some constants,
create some points,
create some lines with different line widths and line patterns between those points (a little bit like creating 3d-objects with OpenScad).
A simple example would be to print the net of a cube that can be printed on paper, cut and glued together.
I see following options:
use a normal programming language like Java and a pdf-creation library (see this question)
program using SVG (can this be printed exactly?)
What other options do you see or can you share experiences about the above options?
I'm a web programmer primarily, so I would create html representing what I wanted printed (in your case, it would require using html canvas element with javascript), and then use an html-to-pdf library to make a PDF. I use PrinceXML, but wkhtmltopdf will also do the trick.
HTML Canvas: http://www.w3schools.com/tags/ref_canvas.asp
Prince XML: http://www.princexml.com/

How to change the style of bullets in pandoc markdown?

Second level bullets in markdown are "-" when converting to pdf. I would like to change them to some other type of bullets (disc or triangle for example). Is there something I can pass in to the pandoc command line to change this? Or something to change in the template?
It looks like there are two possibilities, both which would involve passing your markdown through a LaTeX style file like so:
pandoc -H format.sty -o foo.pdf bar.md
The first uses the Beamer template -- see this thread on changing bullet styles in Beamer. The second possibility uses the enumitem package -- here's another thread on changing bullet styles in this manner. So, I imagine your style file could simply contain the the following, for instance:
\usepackage{enumitem}
\usepackage{amsfonts}
\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\diamond$}
When pandoc converts to PDF, it will place this LaTeX formatting information directly above \begin{document}.

GhostScript render without text

I would like to know, сan GhostScript render pdf on image (such as jpeg) without text? If not, advise the free library for .net, that it will make.
Sorry for my English. Thx!
What do you mean by 'render without text' ? Do you mean that you want all the content of a PDF page rendered to a format which doesn;t contain text (such as JPEG), or do you mean you want all the content of a PDF page except the text rendered, to a file format such as JPEG.
Its possible to elide the text, but its not a command line switch or anything like that, because its pretty hard to see why you want to do this.
If you really do want to do it, then your best bet is to modify the text handling procedures in the PDF interpreter, I would suggest that you don't alter the processing but set the text rendering mode to mode 3 (neither stroke nor fill) to prevent any problems with the current point not being correct.

Generating images using MetaUML

How do you generate images(*.svg, *.gif, *.png ...) with MetaUML?
MetaUML is built on top of MetaPost, which is a tool used with LaTeX to typeset documents. So the output of the MetaUML is ment as graphics for LaTeX documents, which is a PostScript based vector graphics format similar to EPS. You can find more on the MetaPost wiki page.
However you can convert the resulting file, just google "metapost to svg" for example, first hit is this tutorial: http://www.tlhiv.org/MetaPost/tools/mptosvg/

Resources