<c.bu...@posteo.jp> writes:
> Hi, > > in org you can have inline verbatim and code text elements like this. > > Example with =verbatim= and ~code~. > > I would like to understand what "verbatim" really means. What is the > semantic behind it? What content should go in there? > > > I'm aware of the separation of content and its presentation. > I'm also aware of the different renderings in my Emacs. Booth are > monotype but with different colors. > > The org html export to create both with <code> tag. So in HTML output > there is no difference between verbatim and code anymore. > > I also read a lot about the HTML tags code, pre, kbd and samp. > > I wonder that maybe I totally misunderstand the intention of > "verbatim"? > > The background of my question is that I have my own > org-to-html-converter [1] and try to decide how to treat =verbatim=. > Which HTML tag should I use. > > Thanks > Christian > > [1] -- <https://codeberg.org/buhtz/hyperorg> IMO (and it is just my opinion, not that of the org developers), the main use of verbatim (i.e. =text=) is to escape any further interpolation as org markup. It basically says, when exporting, export 'as is' with no further processing. Consider a situation where you want to write A_B, but don't want it to be interpreted as A with a subscript B. There are a number of ways to handle this. One is to set the #+OPTION to ^:nil and turn off the behaviour for the whole file or you can use =A_B= to just turn it off for that use (though this does have other possibly unintended side-effects, such as a font change, but I'm really just trying to illustrate the point here). I would have to look more closely at the output of the HTML export to verify your assertion that both verbatim and code are rendered the same. With respect to 'phrases', I guess there is no real difference in outcome. However, the standard HTML code tag does not preserve line breaks. Traditionally, for blocks of code, the code tag would also be wrapped in the pre tag. However, things have evolved and now it is much more common to see just the code tag with an additional CSS class which is used to manage the preservation of line breaks and whitespace. From a purely tecnical 'correctness' standpoint, I would argue that =text= should be rendered as <pre>text</pre> and not <code>text</code>. When exporting data, we don't have any semantic markers/information for =textg=, so wrapping it in a semantic tag like <code> is IMO incorrect as we are imposing a semantic interpretation without justification. .