d2dagrelayout: Fix regexp
See https://github.com/terrastruct/d2/pull/394#discussion_r1042504655
This commit is contained in:
parent
cb414e5382
commit
d4d6c760e5
1 changed files with 1 additions and 1 deletions
|
|
@ -261,7 +261,7 @@ func escapeID(id string) string {
|
||||||
// fixes \\
|
// fixes \\
|
||||||
id = strings.ReplaceAll(id, "\\", `\\`)
|
id = strings.ReplaceAll(id, "\\", `\\`)
|
||||||
// replaces \n with \\n whenever \n is not preceded by \ (does not replace \\n)
|
// replaces \n with \\n whenever \n is not preceded by \ (does not replace \\n)
|
||||||
re := regexp.MustCompile(`[^\\](\n)`)
|
re := regexp.MustCompile(`[^\\]\n`)
|
||||||
id = re.ReplaceAllString(id, `\\n`)
|
id = re.ReplaceAllString(id, `\\n`)
|
||||||
// avoid an unescaped \r becoming a \n in the layout result
|
// avoid an unescaped \r becoming a \n in the layout result
|
||||||
id = strings.ReplaceAll(id, "\r", `\r`)
|
id = strings.ReplaceAll(id, "\r", `\r`)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue