It appears that the comment symbols cannot be escaped, so it is not possible to use them in the prompt. For example, the # symbol is often used real life contexts these days. Imagine a prompt like:
the man is wearing a t-shirt with the text "#python" in black letters.
Since the # symbol cannot be escaped, the prompt cannot be used. In this case, the end of the line will be chopped off. In more extreme cases, it can break the syntax like this:
the man is wearing a t-shirt with the text {"#python"|"#javascript"|"#geek"|"#BOFH"}.
Here, the closing } symbol will be removed, breaking the syntax of the prompt.
I see references to the # symbol in lots of regular expressions in the dynamicprompts library, so it's probably not trivial to deal with an escape character. If you plan to add this feature, one possibility is to pre-process the prompt string and distinguish between a real comment vs. an escaped comment character. If it is a real comment, you can replace the # with a special ascii code like \x01 or something, then you can use that special ascii code in your regular expressions and comment processing.
In the meantime, my workaround in comfyui is to use a prompt like
a t-shirt with the text "-hash-python"
and then I use a text replacement node to replace "-hash-" with "#" after the dynamic prompts processing is finished.
Thanks for the excellent tool, by the way. In general I think the dynamic prompts work very well.
It appears that the comment symbols cannot be escaped, so it is not possible to use them in the prompt. For example, the # symbol is often used real life contexts these days. Imagine a prompt like:
the man is wearing a t-shirt with the text "#python" in black letters.Since the # symbol cannot be escaped, the prompt cannot be used. In this case, the end of the line will be chopped off. In more extreme cases, it can break the syntax like this:
the man is wearing a t-shirt with the text {"#python"|"#javascript"|"#geek"|"#BOFH"}.Here, the closing } symbol will be removed, breaking the syntax of the prompt.
I see references to the # symbol in lots of regular expressions in the dynamicprompts library, so it's probably not trivial to deal with an escape character. If you plan to add this feature, one possibility is to pre-process the prompt string and distinguish between a real comment vs. an escaped comment character. If it is a real comment, you can replace the # with a special ascii code like \x01 or something, then you can use that special ascii code in your regular expressions and comment processing.
In the meantime, my workaround in comfyui is to use a prompt like
a t-shirt with the text "-hash-python"and then I use a text replacement node to replace "-hash-" with "#" after the dynamic prompts processing is finished.
dynamicprompts/src/dynamicprompts/parser/parse.py
Line 504 in 58815af
Thanks for the excellent tool, by the way. In general I think the dynamic prompts work very well.