elvirbrk / NoteHighlight2016

Source code syntax highlighting for OneNote 2016 and OneNote for O365 . NoteHighlight 2013 port for OneNote 2016 (32-bit and 64-bit)
GNU General Public License v2.0
3.82k stars 392 forks source link

Feature request: Support Cmake #184

Closed hukop closed 1 year ago

hukop commented 1 year ago

Thanks for the great tool. Just discovered it. One language I'm missing is CMake. Would be great to get support for it.

mustng65 commented 1 year ago

Hi @hukop, I ran into this with wanting to format YAML. It looks like there are a bunch of language definitions already there you just have to set them up in the plug in.

The list of supported languages can be found by going to the installation folder for NoteHighlight2016, which can be found either under C:\Program Files (x86)\CodingRoad\NoteHighlight2016\ or C:\Program Files\CodingRoad\NoteHighlight2016\. Then navigate to hightlight > langDefs. In the langDefs folder you should see all the supported languages. (looks like cmake is already there)

Once you confirmed the language it already supported then you just need to edit the ribbon.xml located back in the root NoteHighlight2016 folder. I typically just copy an existing button node and update the details.

Example:

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="GetImage">
    <ribbon>
        <tabs>
            <tab id="tabNoteHighlight" label="NoteHighlight" keytip="H">
                <group id="groupLanguage" label="Language">
...
                    <button id="buttonYAML" label="YAML" size="large" screentip="Enter YAML Code" onAction="AddInButtonClicked" tag="yaml" keytip="Y"  image="Other.png" visible="true"/>
                    <button id="buttonCMake" label="CMake" size="large" screentip="Enter CMake Code" onAction="AddInButtonClicked" tag="cmake"  image="Other.png" visible="true"/>
...
        </group>
        <group label="Advanced" id="Advanced">
                <checkBox id="cbQuickStyle"  label="Quick Style" onAction="cbQuickStyle_OnAction" getPressed="cbQuickStyle_GetPressed"/>
                <checkBox id="cbDarkMode"  label="Dark Mode" onAction="cbDarkMode_OnAction" getPressed="cbDarkMode_GetPressed" screentip="Sets text background to Transparent for Dark Mode compatibility"/>
                <button id="buttonSettings" label="Settings" size="normal" screentip="Advanced settings" onAction="SettingsButtonClicked" image="Other.png" visible="true"/>
        </group>
            </tab>
        </tabs>
    </ribbon>
</customUI>

I just used the Other.png for the image, but I would imagine you could create your own image and place it in the Resources folder located in the root NoteHighlight2016 folder.

In the ribbon.xml file you can also hide languages using the "visible" attribute or reorder them by changing there order in the file.

Once you are done you will need to restart OneNote for it to pick up the changes.

Hope this helps!

hukop commented 1 year ago

Thanks it does help. Would be nicer if this would be achievable through the OneNote GUI. But I consider this issue as closed.