Apply newline replacement in renderPattern to support multi-line image code blocks in reStructuredText (RST) files.#27
Conversation
…e code blocks in reStructuredText (RST) files.
|
A newline works if you apply the setting to the {
"mdPasteEnhanced.renderMap": [
"**/*.md => ",
"**/*.typ => #image(\"${imagePath}\"${userVar})",
"**/*.rst => .. image:: ${imagePath}\n :class: browser-screenshot with-shadow\n :alt: ${imagePath}", // set directly in json
"**/*.rst => .. image:: ${imagePath}\\n :class: browser-screenshot with-shadow\\n :alt: ${imagePath}", // set via UI
"**/* => ${imagePath}",
]
} |
|
Thanks for confirming that newlines work in settings.json. However, for users who prefer using the UI, escaped line breaks aren't visible, leading to confusion if the setting is later reviewed in the UI. By implementing this update, we provide a seamless experience for reStructuredText users, ensuring both JSON and UI configurations display consistently without unexpected escapes. My second pull request supports the hover menu for .rst files and directly relates to this change. Additionally, note that when editing the settings.json directly it still prevents the hover menu from working for rst files. |

Applies newline replacement in renderPattern to support multi-line image code blocks in reStructuredText (RST) files
In RST files, image code blocks often need to span multiple lines, which was previously unsupported. This change may also benefit other formats that require multi-line syntax in the render pattern.
For example, you can now use a render map with \n like:
**/*.rst => .. image:: ${imagePath}\n :class: browser-screenshot with-shadow\n :alt: ${imagePath}Reference: RST image directive documentation