retext icon indicating copy to clipboard operation
retext copied to clipboard

ReText 7.2.1 on Windows: Edit->Preferences creates markdown-extensions.txt in wrong folder

Open UNIVAC-Colonel-Panic opened this issue 4 years ago • 5 comments
trafficstars

  1. Edit->Preferences->Markdown syntax extensions ... -- if the field is blank and then filled in, it creates markdown-extensions.txt in

%appdata%\markdown-extensions.txt

instead of

%appdata%\ReText project\markdown-extensions.txt

But ReText seems to ignore what's in %appdata%\markdown-extensions.txt. For example, if I put toc in "Markdown syntax extensions...", exit and relaunch ReText, go to Edit->Preferences, the toc is still there but putting [TOC] into an actual markdown file doesn't trigger the TOC to be rendered by the preview.

The workaround I'm using for now is to move markdown-extensions.txt into %appdata%\ReText project\.

  1. The Wiki article for Enabling extensions globally states:

If you want some extensions applied to all documents, list them in $HOME/.config/markdown-extensions.txt file. You can also use the “Markdown extensions” field in the Preferences dialog to edit that file.

I realize the above path is for non-Windows platforms, but I'm not sure what it needs to be changed to. I'm mentioning to merely point out that the Wiki probably needs to be changed.

UNIVAC-Colonel-Panic avatar Jul 27 '21 17:07 UNIVAC-Colonel-Panic

No, markdown-extensions.txt file should be not in ReText project, it should be directly in %appdata%. ReText uses the same path when it creates the file and when it reads it to get the extensions names.

It may be the problem that the changes do not immediately take effect: you may need to close the document and open it again. Can you please try that?

mitya57 avatar Jul 27 '21 18:07 mitya57

Yes, I did try that as well as closing ReText itself and relaunching. Still no go.

When I first tried figuring out the problem I looked at ReText.ini but didn't see markdown-extensions.txt.

What would you like me to try next?

UNIVAC-Colonel-Panic avatar Jul 28 '21 16:07 UNIVAC-Colonel-Panic

Can you launch ReText using python.exe instead of pythonw.exe and check if it prints any errors to the console?

Also, can you paste an example of Markdown file where the TOC extension does not work, and the HTML you get (from Edit → View HTML code)?

mitya57 avatar Jul 28 '21 18:07 mitya57

No errors when launching with python.exe, just a line showing the path to the config file.

[TOC]

# Sagan Ipsum

Flatland! Hypatia. Galaxies Orion's sword globular star cluster? Light years quasar as a patch of light gathered by gravity Vangelis radio telescope. Stirred by starlight vanquish the impossible Tunguska event cosmic fugue courage of our questions worldlets galaxies birth colonies. Vastness is bearable only through love.

# Pirate Ipsum

Lookout flogging bilge rat main sheet bilge water nipper fluke to go on account heave down clap of thunder. Reef sails six pounders skysail code of conduct sloop cog Yellow Jack gunwalls grog blossom starboard. Swab black jack ahoy Brethren of the Coast schooner poop deck main sheet topmast furl marooned.

# Cheese Ipsums

## The First

Cheese on toast airedale the big cheese. Danish fontina cheesy grin airedale danish fontina taleggio the big cheese macaroni cheese port-salut. Edam fromage lancashire feta caerphilly everyone loves chalk and cheese brie. Red leicester parmesan cheese and biscuits cheesy feet blue castello cheesecake fromage frais smelly cheese.

## The second

Melted cheese goat stilton. Fromage cream cheese bocconcini macaroni cheese ricotta parmesan cheese slices babybel. Ricotta halloumi everyone loves caerphilly cheeseburger danish fontina emmental smelly cheese. Swiss the big cheese.

# Baseball Ipsum

Baseball ipsum dolor sit amet cellar rubber win hack tossed. Slugging catcher slide bench league, left fielder nubber. Bullpen blue run rotation relief pitcher grass umpire. Forkball bullpen suicide squeeze club bush league field sport. Base cookie triple play blue hot dog relay rake starting pitcher inning.
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="ReText 7.2.1">
<title>example</title>
</head>
<body>
<p>[TOC]</p>
<h1>Sagan Ipsum</h1>
<p>Flatland! Hypatia. Galaxies Orion's sword globular star cluster? Light years quasar as a patch of light gathered by gravity Vangelis radio telescope. Stirred by starlight vanquish the impossible Tunguska event cosmic fugue courage of our questions worldlets galaxies birth colonies. Vastness is bearable only through love.</p>
<h1>Pirate Ipsum</h1>
<p>Lookout flogging bilge rat main sheet bilge water nipper fluke to go on account heave down clap of thunder. Reef sails six pounders skysail code of conduct sloop cog Yellow Jack gunwalls grog blossom starboard. Swab black jack ahoy Brethren of the Coast schooner poop deck main sheet topmast furl marooned.</p>
<h1>Cheese Ipsums</h1>
<h2>The First</h2>
<p>Cheese on toast airedale the big cheese. Danish fontina cheesy grin airedale danish fontina taleggio the big cheese macaroni cheese port-salut. Edam fromage lancashire feta caerphilly everyone loves chalk and cheese brie. Red leicester parmesan cheese and biscuits cheesy feet blue castello cheesecake fromage frais smelly cheese.</p>
<h2>The second</h2>
<p>Melted cheese goat stilton. Fromage cream cheese bocconcini macaroni cheese ricotta parmesan cheese slices babybel. Ricotta halloumi everyone loves caerphilly cheeseburger danish fontina emmental smelly cheese. Swiss the big cheese.</p>
<h1>Baseball Ipsum</h1>
<p>Baseball ipsum dolor sit amet cellar rubber win hack tossed. Slugging catcher slide bench league, left fielder nubber. Bullpen blue run rotation relief pitcher grass umpire. Forkball bullpen suicide squeeze club bush league field sport. Base cookie triple play blue hot dog relay rake starting pitcher inning.</p>

</body>
</html>

Screen capture showing "toc" in preferences:

image

UNIVAC-Colonel-Panic avatar Jul 29 '21 22:07 UNIVAC-Colonel-Panic

It's quite strange. Can you please also:

  • Run pip install --upgrade Markdown Markups to make sure you have the latest versions installed?

  • Add some debug print calls to the _load_extensions_list_from_txt_file function in markups/markdown.py to check what happens there?

    • print(extensions_file) at the beginning of the function, before the with open… line.
    • print(self._split_extension_config(line.rstrip())) before the yield… line and at the same indentation level.
  • And then launch retext using python.exe and check what is printed?

  • If you have time you can also print extension_names and extension_configs here: https://github.com/retext-project/pymarkups/blob/master/markups/markdown.py#L199

If you can't do this debugging then no problem, I will try to test myself on a Windows machine but it won't be fast.

mitya57 avatar Aug 03 '21 13:08 mitya57