clean-mla-gdoc
v1.2.4
Published
A lightweight JavaScript library to reformat Google Docs HTML exports into MLA Style layout with auto-pagination and Works Cited sorting.
Readme
clean-mla-gdoc v1.2.4
A lightweight JavaScript library specifically designed to reformat Google Docs HTML exports into the MLA (Modern Language Association) Style layout. It handles physical pagination, alphabetical sorting of Works Cited, and provides a "DRAFT" watermark feature.
[!IMPORTANT] Compatibility Note: This library is specifically tailored for the Report preset generated by Google Docs when before exporting as HTML.
Features
- Dynamic Tab Title: Automatically renames the browser tab to
[LastName] [FirstName] [AssignmentName]. - Auto-Pagination: Breaks content into 8.5" x 11" pages with 1-inch margins.
- MLA Header: Processes the 4-line header and title from Google Docs classes.
- Smart Date Mapping: Converts numerical dates (e.g.,
25/12/2026) to MLA format (25 Dec. 2026). - Works Cited Sorting: Automatically alphabetizes the "Works Cited" section.
- Draft Mode: Trigger a "DRAFT" watermark by adding
|dto your document header. - Highlighted Citations: hovering cursor over citations highlights them, and clicking them brings user to work cited.
How the Tab Title Works
The script automatically updates the browser tab title following a professional file-naming convention. It extracts the student's name from the first paragraph and the assignment title from the header. To maintain a professional look, the script strips the | draft flag from the tab title while retaining it for the watermark logic.
Final Format: [LastName] [FirstName] [AssignmentName]
Usage & Formatting Rules
Enabling Draft Mode
To enable the "DRAFT" watermark across all pages, include the string | draft (case-insensitive) in the document header.
- Requirement: The
|dflag must be placed after the assignment name. - Example:
English Essay |d
Works Cited
Any content following an element containing the text "Works Cited" will be moved to its own page and sorted alphabetically based on the first word of each entry.
Installation
Include the minified script in your project. The library will automatically detect if jQuery is present; if not, it will load it along with other necessary assets from a CDN.
<!-- Include the library after the meta tag of your head tag -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/clean-mla-gdoc.min.js"></script>Contributing
Contributions are welcome! If Google Docs updates its HTML export structure, please feel free to:
- Fork the repository.
- Update the selectors in the unminified
clean-mla-gdoc.js. - Submit a Pull Request with a description of the changes.
Dependencies
The library dynamically loads the following assets via jsDelivr if they are not already present in the environment:
License
This project is licensed under the GNU General Public License v3.0.
Full license text available at: https://www.gnu.org
Copyright (c) 2026 Musicalisk [email protected]
