How helitoo/sharptex works
Main Components
• User Interface (Frontend):
• HTML (index.html, src/page/document.html): These files provide the primary visual interface for the application.
• CSS (files in src/style): Responsible for styling the document, dropdown menus, floating windows, and loading elements.
• JavaScript (files in src/script): Includes various engines (sharptex_engine.js, dropdown_menu_engine.js, find_n_replace_engine) that handle user actions, text transformations, and UI interactions.
• Conversion/Processing Engine (Backend):
• Python Module (src/generator_engine): Contains app.py, process.py, and other resources (instruction.txt, syntax.csv) that process the custom syntax into LaTeX.
• This component reads input data, applies the conversion logic defined by the custom syntax, and then outputs formatted LaTeX code.
• Supporting Assets and Data:
• The syntax definitions in syntax.csv, which appear to drive how SharpTeX maps its custom syntax to the LaTeX standard.
• Static assets like images (in img/) and presentation material.
Relationships and Interactions
• The User Interface receives raw text input from the user (or an uploaded file) through the web pages.
• JavaScript components (sharptex_engine.js and related modules) likely handle client-side validations and interactivity (e.g., dropdown menus, shortcuts).
• Once the user triggers the conversion (for example, by clicking “Export”), the client-side code sends a request (could be a direct function call if running entirely in-browser, or it may interact with the Python engine if a backend is deployed) to the generator engine.
• The Python generator engine (app.py and process.py) then processes the text using rules defined in syntax.csv and returns the converted LaTeX document.
• The processed document is made available for download as a .zip file that can then be uploaded to an external LaTeX compiler (e.g., Overleaf).
Architectural Patterns and Design Principles
• Separation of Concerns:
• The project cleanly separates UI (HTML/CSS/JS) from the processing logic (Python-based generator engine).
• Modular Design:
• The generator engine itself is isolated in its own directory, indicating that all conversion logic is encapsulated here.
• JavaScript is modular with components for different UI interactions (i.e., find & replace, dropdown menus, character counting).
• Data Flow Control:
• The process starts with user input, then moves through client-side enhancements, and finally to backend processing for conversion before delivering the output.
Relevant Technologies and Frameworks
• Frontend: HTML, CSS, JavaScript – for creating a dynamic interface.
• Backend: Python – responsible for parsing the custom syntax and converting it to LaTeX.
• Other Assets: CSV for syntax mapping; possibly static hosting technology (hinted by the .nojekyll file) for deployment on platforms such as GitHub Pages.