Skip to content

Misleading error message for improper MATLAB code sections #13

@k-deeley

Description

@k-deeley

If you don't close a MATLAB code section properly, e.g. this: bug.md, where I have copy-pasted the matlab flag at the end of the section, you get this message when executing docerrun.

Warning: Error: Invalid text character. Check for unsupported symbol, invisible
character, or pasting of non-ASCII characters. 
> In docerrun>runDiv (line 159)
In docerrun>run (line 109)
In docerrun (line 44) 
```If you don't close a MATLAB code section properly, e.g. this: [bug.md](https://github.com/-/project/14868/uploads/36f0ed842b4138a86fb03ac4f38cc795/bug.md), where I have copy-pasted the matlab flag at the end of the section, you get this message when executing docerrun.

Warning: Error: Invalid text character. Check for unsupported symbol, invisible
character, or pasting of non-ASCII characters. 
> In docerrun>runDiv (line 159)
In docerrun>run (line 109)
In docerrun (line 44)

This lead me hunting for non-ASCII characters, until I eventually spotted the syntax error.

MATLAB treats the bad close as part of the expression to be evaluated. That is what leads to the error message.

>> ```matlab
 ```matlab
 ↑
Error: Invalid text character. Check for unsupported symbol, invisible character, or
pasting of non-ASCII characters.

GitHub automatically closes the unclosed Markdown to yield valid HTML. That is beyond my control. I don't want to get into client-side parsing of Markdown to double check.

Given the resulting HTML, the error message is reasonable, if not particularly clear.

The best I could do would be to augment MATLAB errors with identifier MATLAB:m_illegal_character in docerrun. This supposes that a common type of error is to incorrectly close a code block; I'm not sure that it is.

There's a related discussion at: https://talk.commonmark.org/t/insist-that-code-fenced-blocks-are-properly-closed/232/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions