## Configuration file

ReText has good configuration facilities. The configuration file is usually placed at ~/.config/ReText project/ReText.conf.

The basic syntax is:

[General]
Setting1=Value1
Setting2=Value2


Values can be strings (no quotes needed), integers and booleans. Booleans should be specified as true or false.

## Possible settings

• font, fontSize: Default font used in the resulting text, this doesn't affect editor.
• editorFont, editorFontSize: The same for editor.
• styleSheet, appStyleSheet: Load CSS styles from file, provide canonical file name. appStyleSheet is used for configuring the application window's style. See the documentation for details.
• autoSave: Auto-save files. Value should be either true or false.
• autoPlainText: Set to false if you don't want ReText to automatically enable plain text mode on unknown file formats.
• restorePreviewState: Restore live preview if it was enabled on last close.
• spellCheck, spellCheckLocale: Enable spell checking by default, spellCheck should be either true or false, spellCheckLocale is language code (example: en_US).
• useWebKit: Use QtWebKit engine for text rendering.
• iconTheme: Force ReText to use the given icon theme (works only on X11 systems, on other systems you should use the icons pack or create your own).
• tabWidth: number of spaces the Tab key inserts.
• tabInsertsSpaces: whether Tab key should insert spaces instead of the tabulation character (on by default).
• rightMargin: number of characters to display a margin line after.
• handleWebLinks: (WebKit mode only) whether links should be opened in an external web browser (on by default).
• saveWindowGeometry: set to true if you want ReText to save your window geometry and restore it on startup.
• defaultMarkup: default markup name (usually Markdown or reStructuredText; case insensitive).
• defaultCodec: default files encoding (mostly useful for Windows users). See the documentation for the list of possible encodings.

You can use markdown-extensions.txt file for — one extension per line. List of available Markdown extensions. Markdown Extra extension set is enabled by default (but you can use remove_extra extension to disable it).

Put your markdown-extensions.txt file:

• for individual documents — in the document localtion directory.
• for globally enabling extensions — in ~/.config/markdown-extensions.txt.

There is also one "virtual" extension — mathjax, which enables MathJax math processor.
Example of markdown-extensions.txt file contents (here, we pass a level argument to headerid extension):

sane_lists
mathjax


## Discussion

<< < 1 2 3 4 > >> (Page 2 of 4)
• Anonymous - 2012-10-20

The above description isn't clear, how precisely is markdown-extensions.txt used? What's the syntax?

• Dmitry Shachnev - 2012-10-21

Added an example, hope now it's more clear.

• Anonymous - 2012-11-03

I can't seem to get the extensions working for me.
I made the following textfile -- ~/.config/markdown-extensions.txt:

Abbreviations
Attribute Lists
Definition Lists
Fenced Code Blocks
Tables
Table of Contents
WikiLinks

But nothing happened when I reloaded ReText and I can't get any of the extensions to work.

I have the library markdown installed, what else am I missing here?

• Dmitry Shachnev - 2012-11-03

First of all, markdown-extensions.txt is supported only since ReText 4.0. Use mdExtensions option in the configuration file for 3.1 (as described above).

Then, things like "Table of Contents" are not ReText-readable extensions names, but rather human-readable. When you try to open that extension's page, the URL will look something like this:

http://packages.python.org/Markdown/extensions/toc.html


The basename, i.e. toc is what you should use instead. That is of course a documentation bug, I will now propose a fix upstream.

Finally, the Extra extension set is enabled by default in 4.0, so you should use it.

• Anonymous - 2012-11-03

All clear now and also working.
Thanks a lot!
only two extensions fail to load: abbreviations and code_hilite

• Dmitry Shachnev - 2012-11-04

Looks like my algorithm doesn't always work. Use abbr and codehilite instead. I've updated the docs to make it clear which names to use in this commit, waiting for the maintainer to update the website (use that commit as a temporary reference).

Last edit: Dmitry Shachnev 2012-11-04
• Jason Owens - 2013-01-03

I'm trying to write my own extension. I have it working in my own Python script but I cannot get ReText to find the extension by placing it in markdown-extensions.txt. Should ReText be able to find and use this extension or not?

• Dmitry Shachnev - 2013-01-03

If you have root access, you can simply place your extension in the Python-Markdown installation directory. This command should print that path:

python3 -c "import markdown, os; print(os.path.dirname(markdown.__file__))"


If you don't, you may rename your extension to mdx_something.py and tweak your ReText launcher to add the directory containing that .py file to PYTHONPATH.

• Anonymous - 2013-04-18

what should i do for using MathJax? i just add the below code in the markdown-extensions.txt.
sane_lists mathjax headerid(level=3)
i am a newbie.
can you give me more details for setting?

• Dmitry Shachnev - 2013-04-19

You should put a line break between extension names, but probably you need just mathjax there.

Also, you need to enable WebKit (using Edit menu) and have internet access or libjs-mathjax package installed (in Debian/Ubuntu).

• Anonymous - 2013-04-19

thank you for your quick response.

• David - 2013-05-20

Hi Dmitry - me again. :) I have now installed ReText on a "new" machine (for me): Lubuntu 12.10, and I've got ReText 4.0.1 via the ppa. Working great!

I'm stuck on how to get the Smartypants extension working, since it isn't one of the supported extensions, mentioned above.

In spite of the extra help you gave I can't quite work it out -- probably because I don't know Python!

Would you be willing to provide a step-by-step for 3rd party extensions? Many thanks!

• Dmitry Shachnev - 2013-05-21

How to install 3rd party extension depends on what extension it is. Usually you should name it mdx_something.py and copy it to a directory in your \$PYTHONPATH, like /usr/lib/python3/dist-packages.

Re smartypants extension, I'm currently working on a replacement that will be in standard Python-Markdown library. Follow the GitHub issue to stay tuned.

• Anonymous - 2013-05-21

"restorePreviewState" only works if you use both Preview & Live Preview.

The Live Preview state will be restored, but not just the simple Preview alone.

• Dmitry Shachnev - 2013-05-21

That is expected behaviour. What is the use case for restoring "the simple Preview alone"?

• Anonymous - 2013-05-23

I would like to use ReText as a markdown-reader.

I have some documentation files that are written in markdown. As I work my way through these files I frequently have to open/close ReText, and every time I have to click on "Preview" again.

If "restorePreviewState" works as intended and only affects the live preview, then it should be named something like "restoreLivePreviewState".

• Dmitry Shachnev - 2013-05-23

Yes, it indeed should be possible to use ReText as markdown-reader. I'll add such an option in this or other way.

• Anonymous - 2013-05-24

Thanks, I'm looking forward to this.

• David - 2013-08-22

I have just installed ReText (of course!) on a new machine that has Ubuntu 13.04 on it. It's working nicely (although I needed to hard-set the icons in the config file), and clearly Markdown Extra is working "out-of-the-box".

However, I've got no "Smartypants" -- in an earlier comment you mentioned a new version coming (and I have looked at the Github issue linked).

Question: How do I get Smartypants working with Ubuntu 13.04 and ReText 4.0.1? (I installed from Ubuntu's "Software Centre", btw - not from the mitya57 ppa.)

Thanks!

Last edit: David 2013-08-22
• Dmitry Shachnev - 2013-08-23

It will be available in Python-Markdown 2.4. I will add packages to PPA when it's released, now you can try to build the latest version from GitHub.

• David - 2013-08-23

Thanks, Dmitry -- since I don't know how to build from source, I'll have to wait for the PPA to be updated.

Which PPA should I be watching to ensure I pick up this update? (Thanks fo ryour patience and help!)

• Ryan - 2013-09-27

On Windows, whenever I modify the config file, it gets overwritten by the settings in ReText GUI. And, I can't seem to be able to disable "Open unknown files in plain text mode".

• Dmitry Shachnev - 2013-10-07

On Windows, whenever I modify the config file, it gets overwritten by the settings in ReText GUI.

Which setting are you trying to modify? The configuration dialog is just a wrapper around the global configuration system, so there should be no conflicts there.

And, I can't seem to be able to disable "Open unknown files in plain text mode".

How are you trying to disable that setting? What is the extension of file you are trying to open?

• Ryan - 2013-10-07

The "Open unknown files in plain text mode" setting. If I deselect it in the settings dialog and hit OK, reopening ReText causes it to be re-enabled. If I change it in the config file, it gets overwritten upon restart. I'm using ReText on Windows 7 with PySide.

• Dmitry Shachnev - 2013-11-01

Thanks for reporting the issue and sorry that it took too long. It was a PySide-specific bug, now fixed in git master and 4.1.1.

<< < 1 2 3 4 > >> (Page 2 of 4)

Anonymous