Every paragraph wrap with <p></p>


I need to compile text out of Scrivener for using with the Typo3 Content Management System, so actually I do a copy&paste.
The result is that a whole text, i.e the text has 10 paragraphs, wrapped at the beginnig and the end with the tags: [code]

10 paragraphs

[/code] The HTML markup I need is [code]

paragraph one

paragraph two

[/code]and so on

During my experiments with compiling the draft I saw that the normal HTML export do that, but add <span> tags which I don’t need.

Is there a possibility to customize the HTML output with MarkDown that every single paragraph is wrapped with the [code]

[/code] tags?

Or customizing the “normal” HTML export behaviour?

Thanks for any help

do you need to retain formatting such as font, or is all that in the css for the site?

I only ask because it might be simple enough to use perl to supliment the standard exporter.

perl -pe s/\n\/</p>\n<p>\n/ output.html > wrapped.html

There may need to be a bit more massaging, but that should get you 90% of the way there.

Just to verify, you are double-spacing your paragraphs, right? With the MultiMarkdown-XHTML exporter you should be getting every paragraph wrapped in individual paragraph elements and no span elements at all (unless you have annotations turned on, but those are in-line).

much easier. Do what she says. Ignore those without heads.

Helo AmberV,

No, I use single-spaces. But from now on, I will double-space my documents :smiley:
Thanks for the trick.


Btw, if you need this more often, you should create an Application Service in OS X Snow Leopard for this. Simply copy markdown.pl into a Run-Shell-Script action in Automator, followed by a Copy-to-Clipboard action:


You could also combine this with a script that doubles all your line breaks before they get passed to Markdown. 8)

Hello AmberV and hello signinstranger,

thanks again for the script and the tipps.

The last days I have played around with the MMD XSLT files to become a little bit more familiar with the principles MMD works.
And I added the KOMA-Sripts for export with the scrbook and the scrrpt/scrartcl classes.

Now I ask myself how to differentiate the

tags, concrete I have a text as a discussion with questions at the beginning of any subsection.

Beetween the question as the first subsection should be an empty line, beetween the rest of the paragraphs in the answer not.
If I use “Edit/Insert/Line Break” for the line with the question in scrivener, MMD and the LATEX export did not recognize the extra linebreak.

Do you have an idea or suggestion what to do to get the behaviour for MMD Export to LATEX?

I’m not quite sure if I follow what you are wanting, do you basically want an h_space fill? If so, there is no way to do that in MMD. It really only supports a small subset of LaTeX, and most of it is entirely directed toward structural, rather than visual things like this. You’d probably be best off inserting the LaTeX manually inside an HTML comment in the Scrivener project. Or, if the situation is totally predictable (always a space after the second paragraph in a chapter, for instance) you could code an XSLT match that looks for that and inserts the correct LaTeX. Look up XPath syntax on how to do this, it’s pretty simple.

If you want the ability to insert two lines without a full paragraph break, which it almost sounds like, then simply tap the spacebar twice at the end of the first line.

The menu command you referenced inserted RTF codes into the document. These are completely ignored during MMD export.

I solved it by setting latex commands in the scrartcl.xslt file.
The option “parskip=half+” for example has to be set as an option for the document class.

If somenone is interested in advanced options of the koma-script classes: http://www.dante.de/CTAN/macros/latex/contrib/koma-script/scrguide.pdf

These classes are realy powerfull.

Together with the howto from www.1984produkts.com about Scrivener and MMD, Scrivener is a really powerfull - simply the best :smiley: - frontend for latex exports and it makes a lot of fun, writing with it.
And at least with Textmate as my prefered editor the workflow is optimal.