in command line not able to escape single quote character in mathml
Error: bash: syntax error near unexpected token `<'
Not able to escape single quote character
node /usr/local/lib/node_modules/mathjax-node-cli/bin/mml2svg '<math><mi>μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>' > eqn.svg
CLI issues belong in its repository https://github.com/mathjax/mathjax-node-cli
But I suspect it's just the apostrophe in the mml expression that is closing the argument.
Peter is correct, the problem is the internal ' which closes the initial ' being used as the quotation mark, so the rest of the MathML is being interpreted by bash as part of the command. Try
bin/mml2svg "<math><mi>μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>" > eqn.svg
instead.
Sorry I am already tried the double quotes also which I forgot to mention. That also throws error if the mathml contains attributes.
node /usr/local/lib/node_modules/mathjax-node-cli/bin/mml2svg "<math><mi mathvariant="normal">μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>" > eqn.svg MathML - Error parsing MathML: Unquoted attribute value Column: 66 Char: n
Yes, these are the issues you face when trying to pass content containing quotation marks to command-line programs. One solution would be to use single quotes for the attribute values
bin/mml2svg "<math><mi mathvariant='normal'>μ</mi><msup><mrow><mo>'</mo></mrow><mrow><mn>2</mn></mrow></msup></math>" > eqn.svg
as this is still valid MathML. Alternatively, you can replace the internal ' with ′:
bin/mml2svg '<math><mi mathvariant="normal">μ</mi><msup><mrow><mo>′</mo></mrow><mrow><mn>2</mn></mrow></msup></math>' > eqn.svg
But you will have to modify the original string in some way if it contains both " and ' internally. Either that, or you will need to modify mml2svg in order to take its input from STDIN instead of as a parameter, for example, so that you can pass the MathML string to it directly as input rather than as a command-line parameter, which avoids the problem with command-line special characters.
In any case, none of these are problems with mathjax-node itself, but with your interaction with your command shell, so are really outside the scope of this issue tracker.
Thank you!