Matthew Wilcox <willy@xxxxxxxxxxxxx> writes: > On Mon, Jan 15, 2024 at 12:38:38PM -0700, Jonathan Corbet wrote: >> Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx> writes: >> >> > Hi, >> > >> > I'll try to integrate some documentation which is already written in >> > code comments into the kernel documentation. >> > >> > There I face the problem with a backslash at the end of a line in a >> > 'code block' and this ends up in removing the newline. >> >> Yes, kernel-doc does that...looking at the history, that behavior was >> added in 2012 (commit 65478428443) because otherwise multi-line macros >> are not handled properly. >> >> Fixing this properly is not going to be all that easy; the code reading >> the source file is well before any sort of parsing, so it has no idea of >> whether it's in a comment or not. >> >> A really ugly workaround... put something relatively inconspicuous, like >> " .", after the backslash, and at least your formatting won't be >> mangled. > > Well ... if we're into "ugly workaround" territory, we could use '^ *' > as a marker for "we're in a comment, ignore the backslash". My skills > in this area are terrible, so would something like this work? > > while (!/^ \*/ && s/\\\s*$//) { Thanks! A smoke test looks good (except of required clenaup of some comments which use backslashes). But I'll have a deeper look at it to verify it completely. Thanks, Anna-Maria