![]() Repeat this process for each template you need. If you have similar needs, start the same way you do for a single template, by creating the file custom-reference.odt. Rename the resulting file-for example, to custom-reference-draft.odt-then open it in LibreOffice Writer and modify the styles. Each type of document needs a different template. Some people, however, need more than one.Īt my day job, for example, I use several templates-one with a DRAFT watermark, one with a watermark stating FOR INTERNAL USE, and one for a document's final versions. Many people only need one pandoc template. If you're wondering what a converted file looks like with a customized template, here's an example: Pandoc -t odt file-name.md -reference-doc=path-to-your-file/reference.odt -o file-name.odt The other way to use your template is to type this set of conversion options at the command line: See the next section on how to choose from multiple templates if you need more than one. When it's time to convert a document, pandoc uses this template file. pandoc folder-you might have to create the folder first if it doesn't exist. The easiest way is to drop the template in your /home directory's. So, how do you use that template you just created? There are two ways to do this. ![]() Although the pandoc manual advises against making other changes to the file, I change the page size and add headers and footers when necessary. Open the template file in LibreOffice Writer, and then press F11 to open LibreOffice Writer's Styles pane. If you're using that other word processor, change the references to odt on the command line to docx. This command creates a file called custom-reference.odt. Pandoc -o custom-reference.odt -print-default-data-file reference.odt To create this file, type the following in a terminal window: You need to generate what pandoc calls a reference template, which is the template it uses when converting text files to word processor documents. In order to style your documents, you can't just use any template. In this file, you can edit a small number of styles in the document, including those that control the look of paragraphs, headings, captions, titles and subtitles, a basic table, and hyperlinks. Pandoc has a nifty feature enabling you to specify a style template when converting a marked-up plaintext file to a word processor format. Let's look at how to add a bit more style to the converted documents. These results are serviceable, but a bit bland. Here's what this article looks like when converted to an ODT file: And if you need to create a file for that other word processor (you know the one I mean), replace odt on the command line with docx. Remember to replace filename with the file's actual name. Pandoc -t odt filename.md -o filename.odt Type this command to create an ODT file (which you can open with a word processor like LibreOffice Writer or AbiWord): Then, crack open a console terminal window and navigate to the directory containing the file that you want to convert. To begin, install pandoc on your computer. ![]() Note that pandoc is also available for a wide variety of operating systems, ranging from two flavors of BSD ( NetBSD and FreeBSD) to Chrome OS, MacOS, and Windows. Let's take a look at how to convert a document from Markdown to a word processor format in Linux using pandoc. Using pandoc, you can quickly give people what they want. ![]() The good news is that you're not stuck copying and pasting unformatted text into a word processor document. They prefer documents formatted for a certain proprietary application. Although I've introduced one of the development teams I work with to a Docs Like Code workflow for writing and reviewing release notes, there are a small number of people who have no interest in GitHub or working with Markdown. I run into this issue frequently, especially at the Day Job TM. If you live your life in plaintext, there invariably comes a time when someone asks for a word processor document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |