Fundamentals about configuration of ckeditor in TYPO3:
In common sitepackages there exists a file to configure the ckeditor in Configuration/Yaml/rte_ckeditor/Default.yaml
.
The configuration in this file is some kind of science by itself and can be influenced in many kinds, documentation about it can be found here (take care about the correct version): https://ckeditor.com/.
This configuration file is likely implemented in TYPO3 in your sitepackage in the file ext_localconf.php by this line:
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets'][$extensionKey] = 'EXT:' . $extensionKey . '/Configuration/RTE/Default.yaml';
instead of $extensionKey
the extensionKey might be noted directly without variable.
If you've questions concerning ckeditor directly, i.e. about removing p-tags or other wrappings, I'd advisee to search for those questions or post an own one especially about the issues you want to solve.
Link related handling in TYPO3
TYPO3 is using some own notations for internal links, those are useless if they are used without conversion to real links: t3://page?uid=51
. Details about that format and link handling in general you find on this page: https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Functions/Typolink.html.
Anyway, the parsing of any text fields is done usually by viewHelpers which are using either lib.parseFunc
or lib.parseFunc_RTE
, there some magic concerning links is defined:

The TypoScript library which is used (lib.parseFunc
or lib.parseFunc_RTE
) can be configured in ViewHelpers, this is described here:
https://docs.typo3.org/other/typo3/view-helper-reference/11.5/en-us/typo3/fluid/latest/Format/Html.html
My answer might be a bit diffuse but so is the question. If you've more detailed questions, create new ones with more detailed description what to solve in detail and each one only with one topic.
Nevertheless I hope you get a start with the links I posted.
EDIT:
Important might be still how TYPO3 includes the ckeditor and which transformations are performed by TYPO3.
It'*s a larger chapter with several pages: https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/Rte/Index.html