pymarkdown icon indicating copy to clipboard operation
pymarkdown copied to clipboard

MD024 `siblings_only` works from conf file but not from `--set`

Open cpswan opened this issue 1 year ago • 2 comments

I've been trying to use --set plugins.md024.siblings_only=$!True with no success, whilst if I copy the config fragment from the tests into a file it works as expected:

conf

{"plugins": {"md024": {"siblings_only": True}}}

pymarkdown -c conf scan myfile.md 😃 pymarkdown --set plugins.md024.siblings_only=$!True scan myfile.md 😢 or pymarkdown -s plugins.md024.siblings_only=$!True scan myfile.md also 😢

cpswan avatar Feb 16 '24 18:02 cpswan

I am going to add requests for more information from filed issues, so hopefully that will help.

Is your OS windows? If so, you need to use "plugins.md024.siblings_only=$!True" to keep the parameter together, otherwise it gets split into two parts. If so, you should get a

error: argument --set/-s: invalid verify_manual_property_form value: 'plugins.md024.siblings_only'

To be clear, using your commands as a template, used these two files (remove the .txt for local use) t1.cfg.txt t1.md.txt

and a command line of pymarkdown --set "plugins.md024.siblings_only=$!True" scan t1.md

and things looked good here.

jackdewinter avatar Mar 19 '24 02:03 jackdewinter

I'm not using Windows. I'm running Ubuntu 20.04/22.04, and the shell is Bash.

Your use of quotes on the command line got me pointed in the right direction. I think the problem is command line variable substitution. So:

pymarkdown -s 'plugins.md024.siblings_only=$!True' scan myfile.md works just fine as the single quotes prevent $!True being turned into True. But pymarkdown -s plugins.md024.siblings_only=$!True scan myfile.md and pymarkdown -s "plugins.md024.siblings_only=$!True" scan myfile.md both fail because variable substitution mangles the input.

It's probably worth being explicit about this in the docs/examples as I'd expect many people are using a shell where variable substitution will surface this issue.

cpswan avatar Mar 19 '24 09:03 cpswan

Added this into the new documentation: https://pymarkdown.readthedocs.io/en/latest/advanced_configuration/#special-characters-and-shells

jackdewinter avatar Jun 02 '24 17:06 jackdewinter

Thanks @jackdewinter

cpswan avatar Jun 03 '24 09:06 cpswan