ScrivQ | A template to control Quarto, export multiple files, manage bibliography and easily create cross-references

Hi Paolo,

  • you’ll see that the project uses Styles everywhere, so it does use rich text;
  • links have to be written in markdown style for them to appear in the compiled document [text](link);
  • DO NOT check the Convert rich text to markdown option as this would cause many errors.
  • Documents of the Section Type Standalone File will become a new file.

Page breaks are for PDF and DOCX outputs. This has nothing to do with ScrivQ. If you create a Quarto document and render it to HTML, you’ll see that page breaks have no effect.

Are you picking the desired format in the Compile panel?

  • Bear in mind that, you MUST compile to Multimarkdown, but the output will be of the chosen kind (PDF, DOCX, HTML, or all of them).
  • The dry-run option will only create the files, but will not run Quarto.

Which ScrivQ are you using? Have you tried the latest one from Github?

Hi Bernardo, thank you for your answer.

The ScrivQ template I’m using is dated 29th or August, so it should be the latest one (the ‘Trio’ version).

When compiling, I choose Markdown > ScrivQ HTML or PDF.

I’ve now tried with the Standalone File section type where I want a document to be a separate HTML file, but it seems I still get a single HTML file. But since I see there are other documents missing, maybe I must experiment a bit more to understand how it works.

I deactivated the Convert rich text to markdown option, but then there is no longer paragraph break. I didn’t end paragraphs with a double carriage return, but went on writing as in an ordinary word processor, with a single carriage return at the end of the paragraph. Is this the wrong way?

Going to bed. I’ll continue trying tomorrow.


You could optionally leave an empty line, or use the Body style, just like you would in Microsoft Word.

When you look in Finder, do you see a new file there? The purpose is to turn that document into a new file. That alone means nothing to Quarto unless you also add that path to this file to the project you are rendering.

I use the feature to split the document to generate bibliographies and other support files. But the text itself is just one single file. if you want a project with several files for chapters, that can be done, but it requires some setting up.

Does this help?

I see that the text that I marked with a Body style is indeed considered as a separate paragraph, even without the double carriage return.

The text marked with a Safety Head and a Safety Body style is not (even if these styles have been added to the compile format). Is the Body style explicitly interpreted by the script as a paragraph, while other styles are not?

Yes, there is a single HTML file, together with other files (Quarto.log, a .qmd file, the _quarto.yml file, and the _extensions and [project_name_files folders).

What I was hoping was that ScrivQ could split the project into separate .md files. These are needed for Quarto to create a website made of separate HTML pages, and not a single HTML page.

Did I understand wrongly, when I believed this could be possible with ScrivQ?


I decided to start from a clean project. I create a new one from the ScrivQ template, and delete all the content from the Manuscript section.

I then created two simple documents, to which I assigned the “Standalone File” section type.

Alas, compiling to ScrivQ HTML didn’t split them into separate HTML pages that could be used in a Quarte website. This is the Compile dialog:

These are the generated files:


This is the result in a web browser:

The .qmd file contains this code:

<!-- begin_file: "" -->
This is the first one.

<!-- end_file: "" -->

<!-- begin_file: "" -->
And this is the second one.

<!-- end_file: "" -->


Paolo, the name of the Standalone file should go in the ID field. You can optionally write the name of the file with the extension, or use the Extension custom metadata field to select an extension (leave it empty if you decide to write it down with the filename).

You can see this clearly in action here:

Bernardo, thank you very much for you help! Do you mind if we continue to discuss here, to offer a guide to others that might meet my same problems? As I say, I’m a bit slow at grabbing these things, but maybe I can be used as a general test for the average user.

I’ve added the ID names to my project’s documents:

However, when compiling as ScrivQ HTML, I continue not to see three separate .qmd files. This is what I get:


The HTML file seen in the browser is an empty shell. I don’t see a website, but just that unique HTML file.

What else could I try, having missed to configure it?


Could you include a screen capture of the metadata panel of the first-document.qmd?

Also, see Quarto - Book Structure

@ptram, I just noticed that you are trying to nest files. That is not allowed.

If you think about it, how should nested files behave? Should the overarching file also include the inner documents (in which case we would have part of the text duplicated) or leave it out (in which case they would be exported as two, not nested, but contiguous files)? Either solution would involve changes to the script. So, at the moment, you can’t nest them.

Sure, here it is. The other documents have a similar content (with different ID names):

Considering that I’m dealing with very long and articulate projects, nesting is a necessity for me. If I understand correctly how books and websites are structured in Quarto, nesting is allowed by the specs. All considered, the Quarto website itself is made of nested pages.

I also wonder about your sample text/instructions included in the template. Aren’t they nested files?

I understand that how to deal with a structure is not easy. In an ideal world, the script should be able to replicate the Scrivener project’s Binder in the index of the Quarto project.

A method that I would like even more is to be able to mark a document as a Standalone File, and make all the documents included under its level in the same HTML page. This would allow much flexibility, that can become necessary in a very articulate project with slightly different ways of articulating content.

In any case, I’m still doing something wrong. I’ve flattened my project structure in the Binder, deleted all the previously generated files, and now the script generates three separate .qmd files. Yet, the resulting HTML file (not a web site) is only an empty shell. If you like, you can see it in this archive.


Bernardo, I don’t know if you have already seen how Ioa has tried to solve the issue of splitting a compiled file by way of manually inserted markers. His script has nothing of the complexity of ScrivQ or Scrivomatiq, but it is a little elegant script that might offer a solution to the above question:

Compiling to LaTeX one file per section


Paolo, I believe you are trying to export a Quarto Website (not a Quarto Book, which is not the same thing). Apart from this, two things come to mind right now.

Files can only be nested under folders

This does not mean nesting Standalone File under Standalone File. Right now, you are conflating different things that should not be confused. You can nest sections, elements, metadata, and so on, under Standalone File, that is how it should work.

-- Quarto (yml)
---- Parameter
---- Parameter
-- File (qmd)
---- Section
------ Amsthm Theorem
------ Text
---- Section
------ Text
-- File (qmd)
---- Section
------ Text

Nesting files is illogical, I think,l and this has nothing to do with Quarto specifications. You can only nest files under folders in the system. If you tell the script to create this, then what should it do? It can’t do anything.

-- File
---- File (?!)

Single-page HTML Book vs Website

Even a Quarto book with a single text file requires many many additional files, such as bibliographies, lua filters, yaml configuration files, and so on. ScrivQ currently is perfect for this type of project. I think there is very little to gain from splitting the text itself into several parts (save for a Quarto Website or Blog). Be that as it may, what you are trying to do can be done, that is, exporting a Book/Website made of several files, but only with an overhead as they are more complex in nature. You will have to include in the frontmatter the necessary parameters with the path to the files that make up the Book/Website (required by the Quarto specs).

Could the script try to recreate the binder structure automatically? Probably. I started working on this, but (a.) it is far from trivial, and (b.) I don’t really have a use for this right now. The only gain I could see from this is for making Quarto Websites (which is different from the single-page HTML book).

Hope this helps.

I confirm. I admit I don’t even know what a book published as an HTML page is for. All my university papers have been made with traditional tools, printed and bound.

Yes, but they are allowed by Scrivener. It has a logic, in that a Scrivener project is nested by nature, and not just a container of equal-level sections. A top-level section contains middle-level ones, that can then be split into other lower-level ones. Part, chapter, section. And you can go on, by splitting a section into separate units, like paragraphs or blocks.

However, I now changed the top-level file to a folder. Either marking only this folder as Standalone File, or all the folder and files in it as this type of section, I continue to get an empty HTML file when compiling as HTML.

I suspect we are meaning different things when thinking to split files. I can’t even figure the structure and internal articulation of the above mentioned HTML book. No wonder I continue to try to do something that I can’t achieve.

I’m very curious to see how ScrivQ will evolve, when you can finally also explicitly include the website output format.


What I am trying to explain is that Standalone File is the top-most level element. It is above a Part. Just like you won’t nest a Part inside a Part; or a Part inside a Chapter, you shouldn’t nest a Standalone File inside a Standalone File. (Hence the Standalone part).

With Quarto, you can create a book out of a single [q]markdown file, which would be a Quarto HTML Book. (You can also create a book out of several files as well, but let us leave that aside for the moment). Or, you can create a Website, with an index page, and several linked pages. For these pages to appear, you have to add them to the sidebar, navbar or to the chapters parameter, so that Quarto knows which files to add. You can also add the instruction in a way that all md or qmd files would be added (just check Quarto’s documentation).

If you want to see something appear in the export right now, just change the name of one of the files (or the main exported file) to Then you’ll see the contents of this file on the main page. To see the other, add the Filepath to the appropriate parameters on the frontmatter.

But, having said that, nothing in what you said so far suggests the need to split the text into parts in this fashion, and this severely complicates things. (Perhaps you have specific demands and needs that were not brought up).

7 posts were split to a new topic: Editing Citation Style Language (CSL) files

So I’ve got this working for my own project, an academic monograph. I have a few citation problems to deal with (separate thread), and one problem with the chapter-splitting script, but overall it’s amazing.

The problem I have with the split.rb script is that it seems to move a lot of the footnotes to the wrong file, and I can’t figure out why. Any suggestions on what I should be looking out for in the source markdown file? Or could I send you the whole file for you to try out?

1 Like

If you don’t mind sending the whole thing, I would gladly take a look to see if I can find the cause of the issue. Indeed, the script has to change the format of the footnotes from endnotes to inline footnotes, this way they will always end up in the correct file after the splitting takes place. Maybe this is failing for some reason.

Thanks @bernardo_vasconcelos for looking at this for me. With help from the pandoc-discuss list, I have found that the following command line works for my footnotes:

pandoc --reference-location=block -o

And I’ve now removed the footnote-shifting function calls from the Ruby script. A nice little additional feature of this way of adjusting the footnotes is that it copes with multi-paragraph footnotes, as it just shifts the footnote(s) to immediately follow the paragraph in which the footnote reference occurs.

1 Like

Thanks for reporting back, @lyndondrake! I will most certainly look into this Pandoc flag and maybe add it to ScrivQ in place of the footnote transfer function.

One thing I really like about my personal Scrivener+Pandoc setup is that I can choose which output I want–pdf, tex, docx–and it will output a file that respects my preferences concerning whether a line after an equation or blockquote should be indented or not. With pdf/tex you can use the \noindent command, but for docx that doesn’t work. So I created a new document type called noindent which I assign as desired. Then I have Scrivener set up to apply \noindent when the output is pdf or tex, or else, if the output is docx, it applies a fenced div that tells pandoc to designate the desired unindented text a specific style in a docx reference doc.

Anyway, this setup works great and I’m happy with it. But in using Quarto via rStudio lately—which I really love—I was trying to figure out how to achieve the same flexibility so I could go back and forth between pdf and docx output. Well, if it helps anyone, I found the answer. It’s the complex-paragraphs lua filter here. It works great straight from rStudio, or you can just run it with Pandoc. It is much easier to get up and running with than establishing a setup like the one of my own that I described above.

Just thought I’d mention it, because handling non-indented text after an equation or blockquote was a big issue for me when I wanted the flexibility of outputting to pdf/tex and docx from the same master markdown text.