martinpacker / md2pptx Goto Github PK
View Code? Open in Web Editor NEWMarkdown To PowerPoint converter
License: MIT License
Markdown To PowerPoint converter
License: MIT License
Maybe I was having a bad day but I couldn’t get hyperlinks to work. (They used to.)
Proper damage report soon. Maybe concurrent with the fix. :-)
Today they are (defaulted to probable) black on (hardcoded) green.
It should be easy to make these changeable, perhaps at the slide level. That way you could intersperse green screens with other kinds of fixed-pitch, non-bulleted, presentation.
Zero would lead to special considerations:
Maybe zero is really 0.05 inches or something like that.
Add example files for testing and learning how to use the features.
(Maybe even a combined one with mdpre)
Would allow assignment in an if statement - which would make regex usage more efficient in the standard input parsing code.
or add a second script with extension to use and edit it on iOS (Working Copy, Pythonista and Pyto)
Supporting SVG requires using CairoSVG to convert SVG to temporary PNG.
It would probably render better if CairoSVG was told the dimensions to aim for.
Issue contents
Python3 moved exit to the sys module
md2pptx requires simulation of a Markdown table for more than 1 graphic on a slide. This isn't even compliant with Markdown tables - as the vertical bars would get rendered by other Markdown processors.
This got slightly relaxed a while back - with the terminating vertical bar on a line not being required. This makes editing a little easier.
In reality, though, the table mechanism isn't needed...
... Better to just notice 2 graphics side by side on a line. Likewise a second line with a graphic on.
While this will render differently with any other Markdown processor (I think), it will at least be acceptable.
add input file as a second command line parameter to support running on iOS.
sys.argv[2] would be ok.
typed parameters even better
Maybe allow vertical sizing dynamic metadata.
I'm using Mate 20.04 with python3.8 and earlier releases.
I had to use pip not pip3 for the install to work.
If I used pip3, I get the error when using md2pptx
ModuleNotFoundError: No module named 'pptx'
For reference, here's some output
$ pip3 install python-pptx
Requirement already satisfied: python-pptx in /home/mikeg/.local/lib/python3.8/site-packages (0.6.18)
Requirement already satisfied: lxml>=3.1.0 in /usr/lib/python3/dist-packages (from python-pptx) (4.5.0)
Requirement already satisfied: XlsxWriter>=0.5.7 in /home/mikeg/.local/lib/python3.8/site-packages (from python-pptx) (1.3.7)
Requirement already satisfied: Pillow>=3.3.2 in /usr/lib/python3/dist-packages (from python-pptx) (7.0.0)
$ pip install python-pptx
Collecting python-pptx
Using cached python-pptx-0.6.18.tar.gz (8.9 MB)
Requirement already satisfied: lxml>=3.1.0 in /home/mikeg/.local/lib/python3.7/site-packages (from python-pptx) (4.4.1)
Requirement already satisfied: Pillow>=3.3.2 in /home/mikeg/anaconda3/lib/python3.7/site-packages (from python-pptx) (7.0.0)
Requirement already satisfied: XlsxWriter>=0.5.7 in /home/mikeg/anaconda3/lib/python3.7/site-packages (from python-pptx) (1.2.7)
Building wheels for collected packages: python-pptx
Building wheel for python-pptx (setup.py) ... done
Created wheel for python-pptx: filename=python_pptx-0.6.18-py3-none-any.whl size=275703 sha256=22b1ff963ef5599a2a7a0bed09e31b878c07b36854bb94e9124d4bcd09127559
Stored in directory: /home/mikeg/.cache/pip/wheels/68/99/55/8f6d0c128a214c26ac5b9f75ea68f6387feec407055458af1e
Successfully built python-pptx
Installing collected packages: python-pptx
Successfully installed python-pptx-0.6.18
If I have 1, 2, or 4 graphics on a slide they are appropriately positioned.
If I have 3 the third is placed under the first. It should be centered in the bottom half.
Hi Martin,
during Template Creation (modifying your "Martin Template.pptx" to my templates)
I have some questions that I do not understand.
If you have a quick idea its fine, but I will investigate the other stuff anyway.
##
): The textbox will be moved to your template position even if it takes my settingsDefault would be the same behaviour as today: To put the title above the card.
I'm more than happy to use inclusive language. "Template" is better than "master" in this regard.
I'm sure I uploaded the graphics that illustrate what happens when you specify a "chevron" Table Contents. They seem not to be pulled in - at least on Working Copy.
Today we only support bulleted lists. It would be nice to support numbered lists.
It's actually pretty complex manipulation of the XML to do this - which is why I haven't done it until now.
Steps:
sys.argv[2]
available#Line1856
output_file = sys.argv[1]
input_file = ""
if len(sys.argv) > 2:
from pathlib import Path # move this to front of script
input_path = Path(sys.argv[2])
if input_path.exists():
with input_path.open() as file:
input_file = file.readlines()
else:
input_file = sys.stdin.readlines()
if input_file == "":
sys.exit(-1)
slideNumber = 1
```
TODO:elaborate [Andreas,Martin]
Create a Java Script based action to include other drafts and saving it as a [[title]].mdp in file location accessible by Pytho
Example of the syntax:
### This Is A Title
<a id="my-id"></a>
slideMasterFile
is checked for a path seperator (/
) which is linux and macOS only.
Windows (winOS) sadly uses \
.
Using the pathlib.Path
object from standard library solves that issue completly.
if slideMasterFile != "":
from pathlib import Path # move this to top of script obviusly
if not Path(slideMasterFile).exits():
# Slide master in same directory as md2pptx code
script_path = Path(".")
slideMasterFile = script_path / slideMasterFile
print(f"\nUsing {slideMasterFile} as base for presentation")
Mucks up editing in e.g. BBEdit not having it.
Any more similar characters to backslash escape? Asterisk?
Right now it's a little haphazard. But functions to return rectangles would be good. Something like
titleRect = getTitleRect()
and
contentRect = getContentRect(titleRect)
In the latter case passing in None for titleRect sizes the content as if there were not title.
Suggestion to add in def parseText(text):
# Replace certain entity references with actual characters
text2 = text2.replace("ä", "ä")
text2 = text2.replace("Ä", "Ä")
text2 = text2.replace("ü", "ü")
text2 = text2.replace("Ü", "Ü")
text2 = text2.replace("ö", "ö")
text2 = text2.replace("Ö", "Ö")
text2 = text2.replace("ß", "ß")
text2 = text2.replace("€", "€")
Not sure if Markdown supports this. md2pptx currently seems not to do this. Labeled as a bug because I think Markdown should support it and so should md2pptx
Please close if this makes no sense to you
# [Issue 9](https://github.com/MartinPacker/md2pptx/issues/9)
if matchInfo == None:
continue
# > NOTE:
# Traceback (most recent call last):
# File "md2pptx", line 1997, in <module>
# name = matchInfo.group(1).strip()
# AttributeError: 'NoneType' object has no attribute 'group'
Probably as part of a Table Slide, bearing in mind the limitations of Markdown tables.
The use of a <span>
with bgcolor
would enable syntax colouring - with the colouring created by another tool, such as Codye on iOS.
Is this script available in python 3?
I'm having a problem with a missing template "hipodz.pptx" and I can't find it on the webbernet.
Running
$ md2pptx test/cardTest.md /tmp/cardTest.pptx
md2pptx Markdown To Powerpoint Converter 1.8.1 10 February, 2021
================================================================
Open source project: https://github.com/MartinPacker/md2pptx
Metadata:
=========
Name Value
---- -----
template Martin Template.pptx
template hipodz.pptx
cardlayout horizontal
baseTextSize 20
CardColour BACKGROUND 2
CardTitlePosition inside
cardshadow yes
cardshape rounded
Template file hipodz.pptx does not exist. Terminating.
Commenting out the corresponding template line in cardTest.md fixes the problem.
The code appears to be missing to do this.
Search order should be:
Could allow a mouse-over pop up. (It wouldn’t be rich unless we break Markdown compatibility.)
This would be used sparingly, I think. Here is some example syntax:
<!-- md2pptx: card-height: 70% -->
Using HTML comments means other processors would ignore such an instruction.
CairoSVG - as an optional prereq - should make this possible.
Hi,
my template has a two row title layout.
I would love to set the first row to a text (like the section title)
and the second row to the slides title.
Would this be possible in the given structure of the md2pptx?
Would like it on an image and also on a run of text.
Final card overlaps right hand edge of the slide.
With more metadata, particularly with the style stuff, we should make the first slide better structured to hold it all.
Might not be an issue outside of span.
Use H4 (####
) to define a card on a slide, laying them out side by side.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.