Configuration file

Dmitry Shachnev tnanek

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.

Loading Markdown extensions

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
headerid(level=3)

Related

Wiki: Home

Discussion

1 2 3 4 > >> (Page 1 of 4)
  • Anonymous - 2011-10-14

    On windows 7, where should I put the "ReText.conf." config file?

     
    • Dmitry Shachnev

      Dmitry Shachnev - 2011-10-19

      According to the QSettings documentation, settings are stored either in the Windows registry at HKEY_CURRENT_USER\Software\ReText project\ReText, or, as a fallback option, in file %APPDATA%\ReText project\ReText.ini.

       
      Last edit: Dmitry Shachnev 2011-10-20
  • sdaau

    sdaau - 2011-10-30

    Many thanks for the awesome program! I downloaded the zip on Ubuntu, and I just wanted to note what to do, in order to get the configuration done in that case:

    # cd to Retext dir
    cd ReText_2.1.2
    
    # get an example md friendly css
    wget https://raw.github.com/gist/516763/632b066c7c18edc91485ba13b37ba50a9b2caac7/screen.css -O mdfriendly.css
    
    # since we renamed the css file, add a reference comment
    echo "$(echo "/* from https://gist.github.com/516763 */" | cat - mdfriendly.css)" > mdfriendly.css
    
    # create the config directory
    mkdir ~/."config/ReText project"
    
    # create the settings / configuration file
    cat > ~/."config/ReText project/ReText.conf" <<EOF
    [General]
    mdExtensions=tables,toc
    styleSheet=mdfriendly.css
    EOF
    
    # that should be it - run 
    ./retext.py
    

    Thanks again for the awesome software - cheers!

     
  • Dmitry Shachnev

    Dmitry Shachnev - 2011-12-01

    This file is created first time when you open/save a file in ReText.

    You can open a Python interpreter and run the following:

    >>> from PyQt4.QtCore import QSettings
    >>> print(QSettings("ReText project", "ReText").fileName())
    

    This will print the location of the configuration file.

     
  • Anonymous - 2011-12-29

    Running ReText 2.1.3 on Ubuntu 11.10. I don't see the option to export/upload to Google Docs. Only have HTML, ODT, PDF on the Export menu. How do I enable GDocs export?

     
  • Dmitry Shachnev

    Dmitry Shachnev - 2012-01-22

    You can do it manually, just add

    <link rel="stylesheet" type="text/css" href="path/to/stylesheet.css">
    

    To <head> of exported HTML file.

     
    • Anonymous - 2012-08-22

      still, the exported html is not portable cuz the css stylesheet will not be sent to the one who read the html.

      is it possible to add a feature such that the reference stylesheet will be included inline with the exported html file?

       
  • Anonymous - 2012-01-30

    hi. How can I set the tabstop size.
    Can you give me an explicit setting?

     
    • Dmitry Shachnev

      Dmitry Shachnev - 2012-01-30

      It's not possible yet, but I'll add an option for that later.

       
  • Anonymous - 2012-02-05

    hi,I found that if I run the retext.py in Terminal I will see the GUI in Chinese.But if I click the retext.py to start the program,I will see the GUI in English.Do you have any suggestion let me set Chinese as the Default languange?

     
  • gerlos

    gerlos - 2012-06-25

    I'd like to change default formatting for tables in preview, so I created a new CSS file ~/ReTextStyle.css with some instructions like:

    table {
        border-width: 1px;
        border-spacing: 0px;
        border-style: solid;
        border-color: gray;
        border-collapse: collapse;
        background-color: white;
    }
    

    and added this line to my ReText.conf:

    styleSheet=~/ReTextStyle.css
    

    But nothing changed: tables are still borderless. What am I doing wrong?

     
    Last edit: Dmitry Shachnev 2012-06-26
    • Dmitry Shachnev

      Dmitry Shachnev - 2012-06-26

      ~ shortcut is not supported. Please use absolute paths (like /home/yourusername/ReTextStyle.css).

      Also, from your list only border-color, border-style and background-color properties are supported by QTextDocument (see this page for details). WebKit engine should support everything, though.

       
  • gerlos

    gerlos - 2012-06-26

    Thanks for your answer!
    I corrected the path and now ReText is reading my CSS file.

    I played a little with it. Seems that QTextDocument just ignore what it doesn't support, but supported properties works fine. But can't understand why my CSS code doesn't work in WebKit as I expected.

    This is my CSS code:

    table {
        border-spacing: 0px; 
        border-collapse: collapse; 
    } 
    table th {
        padding: 4px;
        border-color: #000;
        border-style: solid;
        border-width: 1px; 
    }
    table td {
        padding: 4px;
        border-color: #AAA;
        border-style: solid;
        border-width: 1px; 
    }
    
    • In Chromium browser, it displays black borders around table headers, and gray borders elsewhere.
    • In QTextDocument it displays "old style" borders, but at least you can see them.
    • In WebKit, it doesn't display any border at all. My only results gave me borders around the table itself (putting border-color, border-style and border-width in table declaration), but not borders inside of it.
     
    Last edit: Dmitry Shachnev 2012-06-26
    • Dmitry Shachnev

      Dmitry Shachnev - 2012-06-26
       
      • Anonymous - 2012-08-13

        I have the same problem in ubuntu 12.04 using version in repo (2.1.6)

         
        • Dmitry Shachnev

          Dmitry Shachnev - 2012-08-14

          Can you please provide a screenshot of your issue?

           
  • Anonymous - 2012-07-22

    Thanks for the gift, but instead of an empty config file, it would be a real convenience for noobs like me to have it filled with everything commented.

     
    • Dmitry Shachnev

      Dmitry Shachnev - 2012-07-22

      I like your idea, probably I'll do that at some point.

       
    • gerlos

      gerlos - 2012-07-22

      I agree. It could be useful to add an samples to solve doubts like:
      «Should I write:
      styleSheet="/home/username/foo bar/style.css"
      or
      styleSheet=/home/username/foo bar/style.css
      ???»

      Or: «What are my choices about mdExtensions?»

       
      • Dmitry Shachnev

        Dmitry Shachnev - 2012-08-14

        What are my choices about mdExtensions?

        Please read the description more carefully. It says:

        The list of supported extensions is available here.

        I've updated the page to menton that no quotes are needed.

         
  • burak

    burak - 2012-07-22

    Thank you.

     
  • Anonymous - 2012-08-22

    i've got the same problem. added ref to stylesheet css in the config file. with webkit rendering, only the table and th tag were affected. there is no effect on td tag.

    btw, with the above, i was able to generate pdf with table modified by the stylesheet. however, the exported html has no effect. how could i do that?

     
    • Dmitry Shachnev

      Dmitry Shachnev - 2012-08-22

      OK, I will add an option to include CSS inline to the exported HTML. For now you can just do that manually.

       
      • Anonymous - 2012-08-30

        tkyou for your quick response.

        pls also note the rendering issue that td tag was not affected by the stylesheet defined in config file.

        tks again

         
      • Dmitry Shachnev

        Dmitry Shachnev - 2012-09-10

        This is now fixed in ReText 4.0 Git, see https://sourceforge.net/p/retext/tickets/38/#eccd.

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


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks