# Is it possible to access FrontEnd's own conversion rules for boxes?

Before sending its output to the FrontEnd the Kernel converts it into boxes by applying MakeBoxes. But it is not the whole story. FrontEnd not just displays the box expression sent by the Kernel but preliminarily converts in into another box expression (usually even more verbose) apparently by applying something like its own internal analog of MakeBoxes.

In the Kernel we can access the conversion rules via FormatValues.

I have two questions:

1. Is it possible to get the FrontEnd's conversion rules in any form?

2. It seems that one way to get the final box expresison is

ImportString[ExportString[expr, "NB"], "NB"][[1, 1, 1, 1]]


Is there a more direct way?

• I was using what you show in 2. – Kuba Mar 20 '17 at 7:02
• Can you provide an example of such transformation on a front end side? – Kuba Apr 4 '17 at 14:34
• @Kuba Everything related to GridBox undergoes such transformation, one practical example was discussed in this thread. – Alexey Popkov Apr 4 '17 at 14:44
• I see, btw. I think even this method is not enough as a FrontEnd renames some symbols in cell expressions (DynamicModuleBox etc) based on current \$Context and CellContext. It won't be reflected here. The only way I know is to really create such cell, e.g. CreateDocument and NotebookRead/Get from there. – Kuba Apr 10 '17 at 8:22
• @Kuba It seems the ImportString/ExportString method does exactly this under the hood. It is easy to implement oneself though: toFinalBoxes[expr_]:=Module[{nb,nbObj=CreateDocument[expr,Visible->False]},nb=NotebookGet[nbObj];NotebookClose[nbObj];nb[[1,1,1,1]]]. – Alexey Popkov May 30 '17 at 8:33