Intra-word emphasis #1157
-
Is it possible at all to turn off intra-word emphasis, and more particularly, the escaping of underscores in snake_case_file_names when extracting markdown from the editor? My use case is to allow people to create README.md files that include many, many references to filenames. The insertion of escape characters inside words is not helpful when sharing those README files as plain text. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Yes, you can configure the inlineSyncPlugin, the default config is defined here. Maybe this is what you want: Editor.make()
.config(ctx=> {
ctx.update(inlineSyncConfig.key, (defaultConfig) => {
return {
...defaultConfig,
movePlaceholder: (placeholderToMove: string, text: string) => {
const symbolsNeedToMove = ['*']
function swap(text: string, first: number, last: number) {
const arr = text.split('')
const temp = arr[first]
if (arr[first] && arr[last]) {
arr[first] = arr[last] as string
arr[last] = temp as string
}
return arr.join('').toString()
}
let index = text.indexOf(placeholderToMove)
while (symbolsNeedToMove.includes(text[index - 1] || '') && symbolsNeedToMove.includes(text[index + 1] || '')) {
text = swap(text, index, index + 1)
index = index + 1
}
return text
},
}
})
}) With this method, you'll prevent the |
Beta Was this translation helpful? Give feedback.
I think milkdown also won't parse
intra_word_emphasis
to italic. If you mean the output file will transform it intointra\_word\_emphasis
. I think it's the behavior of remark. Maybe you can find a way to configure theremark-stringify
to change the behavior.https://stackblitz.com/edit/stackblitz-starters-7orxg2?file=index.js