I plan to publish latex code on WordPress. My VPS has a full installation of texlive and my WordPress will call xelatex or pdflatex to generate pdf, and my WordPress will also call pandoc to generate html.
I am new to WordPress (plugin) development, but I guess my workflow can be implemented as a custom post.
register_post_type( 'latex_page',
array('supports'=> array( 'title', 'editor'),
...
));
This piece of code adds 'editor' to the supports
option, and users will write their latex code in the WordPress editor.
But the WordPress editor by default is Gutenberg editor. Its block style is completely useless for a latex file. Even if I switch to the classic editor, the <b>
, <i>
buttons and the like are not necessary.
What's more, the edit page displays an "Add Media" button. The logic of the "Add Media" button doesn't work with Latex. Latex uses the syntax like \includegraphics[width=1em]{github.png}
, but the "Add Media" button adds the code <a href="github.png"><img src="github.png></a>
. To avoid complexity, for now I do not want to allow users to use includegraphics.
I am a mathematician. So by definition, what is the WordPress editor? What content does it suppose to edit?
I figure rather than disabling everything in the feature-rich editor, why don't I just use a plain text custom field to hold latex code?