Copy link to clipboard
Copied
This is kicking my butt. I am comfortable with coding, scripting, xml, html, ..., ..., ..., but I cannot get this figured out. I was hoping there would be some kind of way to
Oddly, InDesign seems to import several such formats, and export several such formats, but as far as I can tell, there is ZERO overlap. XML looks like it would be two-way, but every xml export I try just generates an empty xml file.
I'm happy to do this *any* way. Scripting, writing a simple converter, clicking menu items, whatever. In fact, I'm happy to pay someone else to do it for me. But I want to get something working well enough that I know I'm on the right track with my input.
My latest attempt has been
This doesn't work, I'm losing images. Example images and documents for all steps at this GitHub link. Appreciate any help.
Have you looked at exporting to IDML - as IDML is basically xml
So in paragraph styles fly out (and most of the styles menus there is an option for Edit Export Tags)
You can pick predefined styles - or put in your own
Export to IDML
Change the extension to .zip
unzip the folder
In the resources folder is a styles.xml
And you'll see the p3 tag has been applied
Is this along the lines of what you're after?
Copy link to clipboard
Copied
From long familarity with InDesign, HTML/CSS, some XML and — regrettably — Markdown, I would say there's no way to get from Markdown to InDesign without a wholly custom code conversion project.
The only thing close to MD or HTML that InDesign imports is XML; I can't see any route here except a conversion from MD to XML This could be done in a number of ways including repetitous search-and-replace or GREP to convert one code structure at a time, along with some more sophisticated scripting in a macro-enabled text editor.
Maybe others here with deeper conversion and file structure experience have a better solution, but I think you are outlining one of the most nearly impossible conversions in the whole doc spectrum — simply because Markdown is a deliberately simplified tinker-toy approach to document structure, not really conforming to any standard but its own and forcing all but the most unimaginative, vanilla users to use what CSS elements will work, or elaborate, oddball combinations of its features.
I'm close to saying "forget it — rebuild the documents in InDesign from what text export and scrapes you can extract, and forget about any sort of conversion that preserves formatting, structrure, image placement, etc." Close but maybe not adamant.
(I use Doc360 for a client and have worked with other MD tools and environments, and think of it as something only a developer team could love, more "coding documents" than any kind of actual document tool. But it sounds like you've made the mistake of writing something very large and complex in it, and now need to get that project into a real doc platform. I hope someone here has better ideas than I do... 😛 )
Copy link to clipboard
Copied
Ha! That was discouraging, but it was a fun read. Thank you for the feedback.
Copy link to clipboard
Copied
Yeah, sorry, I've come to really hate Markdown. I'm tasked with maintaining and expanding a large online library for outside users, and I am often reminded of kindergarten, when you had to do everything on that weird lined paper, with a giant pencil and two odd colors of crayon.
(I've also spent too many decades battling the idea of documentation from the Dev viewpoint, when what's needed is docs from the end user viewpoint. MD is very much another swing at the "engineering-sourced/self documenting" chimera.)
Copy link to clipboard
Copied
I don't disagree, but I wanted to write my book in plain text so I could edit and arrange it with scripts. Now, it seems I'm one script short.
That's the markdown appeal, we can work in our code editors. After my own decaded "from the dev viewpoint", that's where I feel 10x more productive.
FWIW, I can create a seemingly perfect docx from the markdown, but I can't seem to bring the images along with it. I'm usually able to pick up a new interface quickly because I have deep experience in a few niches and shallow experience across many more, but InDesign is beating me! Badly!
Copy link to clipboard
Copied
DOCX to the primary formatted 'manuscript' and then manually placing the images would be a fairly streamlined approach. SVG is a bit hinky in InDesign and I am not sure having it import, inline, would save much time over manually placing them. I suspect every 'imported' one would have to be manually massaged anyway.
Copy link to clipboard
Copied
Have you looked at exporting to IDML - as IDML is basically xml
So in paragraph styles fly out (and most of the styles menus there is an option for Edit Export Tags)
You can pick predefined styles - or put in your own
Export to IDML
Change the extension to .zip
unzip the folder
In the resources folder is a styles.xml
And you'll see the p3 tag has been applied
Is this along the lines of what you're after?
Copy link to clipboard
Copied
That's exactly it! Thank you. I have already written a somewhat popular parsing library for docx files, which are very close to this structure. My workflow in docx is to
This is how I make my invoices. Looks like I will be able to put this together with just a bit of tweaking. Thank you!
Copy link to clipboard
Copied
I missed a turn. How to you export to IDML from Markdown? Or is this MD to DOCX to InDesign to IDML to pseudo-XML...?
If the goal is to bring it into InDesign for some kind of advanced publication formatting, I'm completely missing the point of this merry-go-round... 🙂
Copy link to clipboard
Copied
The idea is to meet in the middle. InDesign can import markup files. These look like
<tag ... some formatting options>Content</tag>
The problem is knowing what "some formatting options" look like. For instance, docx file internal xml conforms to the ECMA-388 standard, or at least it's supposed to. Probably, there are parts of that standard (IT'S HUGE) that have not been implemented. There area likely also things Microsoft have added that are not in the standard.
I have some experience with such formats, so I can probably guess how to specify font-size, font-weight, and a few others, but I have no idea what instruction InDesign might understand for "always start this paragraph style on a new page."
So a reasonable and common way forward is to open a native InDesign file and see what instructions have been used. In InDesign, I can make a paragraph with the text "LOOK HERE", format that paragraph however I like, then look at the export, find "LOOK HERE" and see how it's formatted.
With the right tools, you don't even have to look. You can parse the export and identify the XML element with "LOOK HERE" text. Once you've identified it, you can alter it, copy it, whatever and then stick these copies back into the xml file whever you like. This way, you don't have to build a converter for the entire InDesign XML specification, just the tiny slice you're using.
Copy link to clipboard
Copied
You also don't have to build an entire import file. You can keep the file structure from the export, change out the little bit you need to change out, then import the edited export.
Copy link to clipboard
Copied
Is there some reason why you're converting Markdown to docx? I mean, maybe I'm missing something, but you could go straight from Markdown to icml, and place the icml directly into InDesign.
If your svg is dropping when you convert with pandoc, isn't that maybe a question for the pandoc maintainer(s)? I mean, I don't know if you can slip an svg into icml, but you certainly should probably be able to get an svg into a docx, and you're reporting that this doesn't work.
XML looks like it would be two-way, but every xml export I try just generates an empty xml file.
Can you either describe your workflow here, or post a sample document? Because an empty XML file is not the expected export. I don't want to PEBCAK you, but you know, maybe the empty XML export is down to you not using InDesign's wonky XML tools correctly?
Copy link to clipboard
Copied
PEBCAK is the reason behind every one of these "whys". I'm sure of it. That's why I'm asking for help instead of filing a bug report. I spent several hours trying different workflows. With each path, I ran into something I didn't know how to work through.
Thank you for the feedback.