UNPKG

@yamlresume/core

Version:
1,232 lines (1,214 loc) 68.6 kB
/** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** Represents a bold formatting mark. */ type BoldMark = { type: 'bold'; }; /** Represents a link mark with optional attributes. */ type LinkMark = { /** Optional attributes for the link. */ attrs?: { /** The URL the link points to. */ href: string; /** CSS class attribute, typically null. */ class: string | null; /** Link target attribute (e.g., '_blank'), often null or empty. */ target: string; }; type: 'link'; }; /** Represents an italic formatting mark. */ type ItalicMark = { type: 'italic'; }; /** Represents an underline formatting mark. */ type UnderlineMark = { type: 'underline'; }; /** Represents a union of all possible inline formatting marks. */ type Mark = BoldMark | ItalicMark | LinkMark | UnderlineMark; /** Represents a sequence of child nodes, often used for block node content. */ type Fragment = Node[] | undefined; /** Represents a bullet list node (unordered list). */ type BulletListNode = { /** Child nodes (typically ListItemNode) contained within this list. */ content?: Fragment; type: 'bulletList'; /** Optional attributes, typically only includes 'start' which defaults to 1 * but isn't semantically used for bullet lists. */ attrs?: { start: 1; }; }; /** Represents the root node of the document tree. */ type DocNode = { /** The top-level block nodes (like ParagraphNode, BulletListNode, etc.) of the * document. */ content?: Fragment; type: 'doc'; }; /** Represents an item within a list (either bullet or ordered). */ type ListItemNode = { /** Child nodes (like ParagraphNode) contained within this list item. */ content?: Fragment; type: 'listItem'; }; /** Represents an ordered list node. */ type OrderedListNode = { /** Child nodes (typically ListItemNode) contained within this list. */ content?: Fragment; type: 'orderedList'; /** Optional attributes for the list. */ attrs?: { /** The starting number for the ordered list. */ start: number; }; }; /** Represents a paragraph block node. */ type ParagraphNode = { /** Inline child nodes (like TextNode) contained within this paragraph. */ content?: Fragment; type: 'paragraph'; }; /** Represents a plain text node, with optional associated formatting marks. */ type TextNode = { /** Optional formatting marks (like BoldMark, LinkMark) applied to this text * span. */ marks?: Mark[]; /** The actual text content. */ text: string; type: 'text'; }; /** * Represents a union of all possible node types in the document tree. * * These node types are inspired by the Tiptap editor. * * @see {@link https://tiptap.dev/docs/editor/core-concepts/schema} **/ type Node = BulletListNode | DocNode | ListItemNode | OrderedListNode | ParagraphNode | TextNode; /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Interface to generate code from an AST. * * This interface defines the contract for code generation of abstract syntax * tree (AST) nodes. Implementations of this interface are responsible for * converting AST nodes into their corresponding code representations. * * @see {@link Node} */ interface CodeGenerator { /** * Generate code from an AST node. * * @param node - The AST node to generate code from. * @returns The generated code. */ generate(node: Node): string; } /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Generate LaTeX code from a Node. * * This class implements the `CodeGenerator` interface and provides a method * to convert an AST node into its corresponding LaTeX code. * * @see {@link CodeGenerator} */ declare class LatexCodeGenerator implements CodeGenerator { /** * Generate LaTeX code from an AST node. * * @param node - The AST node to generate LaTeX code from. * @returns The generated LaTeX code. */ generate(node: Node): string; } /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Interface for parsing input strings into AST nodes. * * Implementations of this interface are responsible for converting input * strings into their corresponding abstract syntax tree (AST) representations. * * @see {@link Node} */ interface Parser { /** * Parse an input string into an AST node. * * @param input - The input string to parse. * @returns The parsed AST node. */ parse(input: string): Node; } /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Parse markdown to ast node * * Under the hood this class first parse the markdown to mdast and then * transform the mdast to ast node. * * @see {@link Parser} */ declare class MarkdownParser implements Parser { /** * Parse markdown to ast node * * @param input - The markdown input to parse * @returns The ast node */ parse(input: string): Node; } /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * All possible countries and regions in the world. */ declare const COUNTRY_OPTIONS: readonly ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "Cote D'Ivoire (Ivory Coast)", "Croatia", "Cuba", "Curaçao", "Cyprus", "Czech Republic", "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji Islands", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia The", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey and Alderney", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong S.A.R.", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau S.A.R.", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Man (Isle of)", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "North Macedonia", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory Occupied", "Panama", "Papua new Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn Island", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russia", "Rwanda", "Saint Helena", "Saint Kitts And Nevis", "Saint Lucia", "Saint Pierre and Miquelon", "Saint Vincent And The Grenadines", "Saint-Barthelemy", "Saint-Martin (French part)", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten (Dutch part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia", "South Korea", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard And Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas", "Togo", "Tokelau", "Tonga", "Trinidad And Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks And Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City State (Holy See)", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (US)", "Wallis And Futuna Islands", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"]; /** * Type for all possible countries and regions in the world. */ type Country = (typeof COUNTRY_OPTIONS)[number]; /** * Represents all possible countries & regions with their corresponding English * names. */ declare const EnglishCountryNames: Record<Country, string>; /** * Represents all possible countries & regions with their corresponding * Simplified Chinese names. */ declare const SimplifiedChineseCountryNames: Record<Country, string>; /** * Represents all possible countries & regions with their corresponding * Traditional Chinese HK names. */ declare const TraditionalChineseCountryHKNames: Record<Country, string>; /** * Represents all possible countries & regions with their corresponding * Traditional Chinese TW names. */ declare const TraditionalChineseCountryTWNames: Record<Country, string>; /** * Represents all possible countries & regions with their corresponding * Spanish names. */ declare const SpanishCountryNames: Record<Country, string>; /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * All valid top-level sections in the resume. * */ declare const SECTION_IDS: readonly ["basics", "location", "profiles", "work", "education", "volunteer", "awards", "certificates", "publications", "skills", "languages", "interests", "references", "projects"]; type SectionID = (typeof SECTION_IDS)[number]; /** Categorizes social networks for potential grouping or display purposes. */ type SocialNetworkGroup = 'Chat' | 'Design' | 'Media' | 'Social' | 'Technical' | 'WWW'; /** Defines supported social media and professional network identifiers. * * TODO: should we move this to TypeScript enum? */ type SocialNetwork = 'Behance' | 'Dribbble' | 'Facebook' | 'GitHub' | 'Gitlab' | 'Instagram' | 'Line' | 'LinkedIn' | 'Medium' | 'Pinterest' | 'Reddit' | 'Snapchat' | 'Stack Overflow' | 'Telegram' | 'TikTok' | 'Twitch' | 'Twitter' | 'Vimeo' | 'Weibo' | 'WeChat' | 'WhatsApp' | 'YouTube' | 'Zhihu' | ''; type KeywordsType = string[]; /** Represents a single award item. */ type AwardItem = { /** The organization or entity that gave the award. */ awarder?: string; /** The date the award was received (e.g., "2020", "Oct 2020"). */ date?: string; /** A short description or details about the award (supports rich text). */ summary?: string; /** The name or title of the award. */ title?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed date string. */ date?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'awards' section of the resume content. */ type Awards = { /** An array of award items. */ awards?: AwardItem[]; }; /** Represents the basic personal information. */ type BasicsItem = { /** Email address. */ email?: string; /** A brief professional headline or title (e.g., "Software Engineer"). */ headline?: string; /** Full name. */ name?: string; /** Phone number. */ phone?: string; /** A professional summary or objective statement (supports rich text). */ summary?: string; /** Personal website or portfolio URL. */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed summary string (e.g., LaTeX code). */ summary?: string; /** Transformed URL string (e.g., LaTeX href command). */ url?: string; }; }; /** Represents the 'basics' section of the resume content. */ type Basics = { /** The basic personal information item. */ basics?: BasicsItem; }; /** Represents a single certification item. */ type CertificateItem = { /** The date the certificate was obtained (e.g., "2021", "Nov 2021"). */ date?: string; /** The organization that issued the certificate. */ issuer?: string; /** The name of the certificate. */ name?: string; /** URL related to the certificate (e.g., verification link). */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed date string. */ date?: string; }; }; /** Represents the 'certificates' section of the resume content. */ type Certificates = { /** An array of certificate items. */ certificates?: CertificateItem[]; }; /** Represents a single education history item. */ type EducationItem = { /** Field of study (e.g., "Computer Science"). */ area?: string; /** List of courses taken (can be string array or pre-joined string). */ courses?: string[] | string; /** End date of study (e.g., "2020", "May 2020"). Empty implies "Present". */ endDate?: string; /** Description of accomplishments or details (supports rich text). */ summary?: string; /** Name of the institution. */ institution?: string; /** GPA or academic score. */ score?: string; /** Start date of study (e.g., "2016", "Sep 2016"). */ startDate?: string; /** The type of degree obtained. */ degree?: Degree; /** URL related to the institution or degree. */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed courses string (e.g., comma-separated). */ courses?: string; /** Combined string of degree, area, and score. */ degreeAreaAndScore?: string; /** Combined string representing the date range. */ dateRange?: string; /** Transformed start date string. */ startDate?: string; /** Transformed end date string (or "Present"). */ endDate?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'education' section of the resume content. */ type Education = { /** An array of education history items. */ education?: EducationItem[]; }; /** Represents a single interest item. */ type InterestItem = { /** Keywords related to the interest. */ keywords?: KeywordsType; /** Name of the interest category (e.g., "Reading", "Photography"). */ name?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed keywords string (e.g., comma-separated). */ keywords?: string; }; }; /** Represents the 'interests' section of the resume content. */ type Interests = { /** An array of interest items. */ interests?: InterestItem[]; }; /** Represents a single language proficiency item. */ type LanguageItem = { /** The language spoken. */ language?: Language; /** The level of proficiency in the language. */ fluency?: LanguageFluency; /** Specific keywords related to language skills (e.g., "Translation"). */ keywords?: KeywordsType; /** Computed values derived during transformation. */ computed?: { /** Translated fluency level string. */ fluency?: string; /** Translated language name string. */ language?: string; /** Transformed keywords string. */ keywords?: string; }; }; /** Represents the 'languages' section of the resume content. */ type Languages = { /** An array of language items. */ languages?: LanguageItem[]; }; /** Represents the location information. */ type LocationItem = { /** Street address. */ address?: string; /** City name. */ city?: string; /** Country code or name. */ country?: Country; /** Postal or ZIP code. */ postalCode?: string; /** State, province, or region. */ region?: string; /** Computed values derived during transformation. */ computed?: { /** Combined string of postal code and address. */ postalCodeAndAddress?: string; /** Combined string of region and country. */ regionAndCountry?: string; /** Fully formatted address string based on locale. */ fullAddress?: string; }; }; /** Represents the 'location' section of the resume content. */ type Location = { /** The location information item. */ location?: LocationItem; }; /** Represents a single online profile item (e.g., GitHub, LinkedIn). */ type ProfileItem = { /** The name of the social network or platform. */ network?: SocialNetwork; /** The URL of the profile. */ url?: string; /** The username on the platform. */ username?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed URL string (e.g., LaTeX href with icon). */ url?: string; }; }; /** Represents the 'profiles' section of the resume content. */ type Profiles = { /** An array of online profile items. */ profiles?: ProfileItem[]; }; /** Represents a single project item. */ type ProjectItem = { /** Description of the project. */ description?: string; /** End date of the project (e.g., "2022", "Jul 2022"). */ endDate?: string; /** Keywords or technologies used in the project. */ keywords?: KeywordsType; /** Name of the project. */ name?: string; /** Start date of the project (e.g., "2021", "Jan 2021"). */ startDate?: string; /** Detailed accomplishments for the project (supports rich text). */ summary?: string; /** URL related to the project (e.g., repository, live demo). */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed keywords string. */ keywords?: string; /** Combined string representing the date range. */ dateRange?: string; /** Transformed start date string. */ startDate?: string; /** Transformed end date string (or "Present"). */ endDate?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'projects' section of the resume content. */ type Projects = { /** An array of project items. */ projects?: ProjectItem[]; }; /** Represents a single publication item. */ type PublicationItem = { /** Name or title of the publication. */ name?: string; /** Publisher of the work. */ publisher?: string; /** Date of publication (e.g., "2023", "Mar 2023"). */ releaseDate?: string; /** URL related to the publication (e.g., DOI, link). */ url?: string; /** Summary or abstract of the publication (supports rich text). */ summary?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed release date string. */ releaseDate?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'publications' section of the resume content. */ type Publications = { /** An array of publication items. */ publications?: PublicationItem[]; }; /** Represents a single reference item. */ type ReferenceItem = { /** Email address of the reference. */ email?: string; /** Name of the reference. */ name?: string; /** Phone number of the reference. */ phone?: string; /** Relationship to the reference (e.g., "Former Manager"). */ relationship?: string; /** A brief note about the reference (supports rich text). */ summary?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'references' section of the resume content. */ type References = { /** An array of reference items. */ references?: ReferenceItem[]; }; /** Represents a single skill item. */ type SkillItem = { /** Specific keywords or technologies related to the skill. */ keywords?: KeywordsType; /** Proficiency level in the skill. */ level?: SkillLevel; /** Name of the skill. */ name?: string; /** Computed values derived during transformation. */ computed?: { /** Translated skill level string. */ level?: string; /** Transformed keywords string. */ keywords?: string; }; }; /** Represents the 'skills' section of the resume content. */ type Skills = { /** An array of skill items. */ skills?: SkillItem[]; }; /** Represents a single volunteer experience item. */ type VolunteerItem = { /** End date of the volunteer work (e.g., "2020", "Dec 2020"). */ endDate?: string; /** Name of the organization. */ organization?: string; /** Role or position held. */ position?: string; /** Start date of the volunteer work (e.g., "2019", "Jun 2019"). */ startDate?: string; /** Summary of responsibilities or achievements (supports rich text). */ summary?: string; /** URL related to the organization or work. */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Combined string representing the date range. */ dateRange?: string; /** Transformed start date string. */ startDate?: string; /** Transformed end date string (or "Present"). */ endDate?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'volunteer' section of the resume content. */ type Volunteer = { /** An array of volunteer experience items. */ volunteer?: VolunteerItem[]; }; /** Represents a single work experience item. */ type WorkItem = { /** Name of the company or employer. */ name?: string; /** End date of employment (e.g., "2023", "Aug 2023"). */ endDate?: string; /** Job title or position held. */ position?: string; /** Start date of employment (e.g., "2021", "Apr 2021"). */ startDate?: string; /** Keywords related to the role or technologies used. */ keywords?: KeywordsType; /** Summary of responsibilities and accomplishments (supports rich text). */ summary?: string; /** URL related to the company or work. */ url?: string; /** Computed values derived during transformation. */ computed?: { /** Transformed keywords string. */ keywords?: string; /** Combined string representing the date range. */ dateRange?: string; /** Transformed start date string. */ startDate?: string; /** Transformed end date string (or "Present"). */ endDate?: string; /** Transformed summary string (e.g., LaTeX code). */ summary?: string; }; }; /** Represents the 'work' section of the resume content. */ type Work = { /** An array of work experience items. */ work?: WorkItem[]; }; /** Union type representing the structure for any top-level resume section. */ type SectionDefaultValues = Awards | Basics | Certificates | Education | Interests | Languages | Location | Profiles | Projects | Publications | References | Skills | Volunteer | Work; /** Type defining the structure for a single default item within each resume * section. */ type ResumeItem = { award: AwardItem; basics: BasicsItem; certificate: CertificateItem; education: EducationItem; interest: InterestItem; language: LanguageItem; location: LocationItem; project: ProjectItem; profile: ProfileItem; publication: PublicationItem; reference: ReferenceItem; skill: SkillItem; volunteer: VolunteerItem; work: WorkItem; }; /** Defines the structure for the entire resume content, including all sections * and computed values. */ type ResumeContent = { /** Array of award items. */ awards: AwardItem[]; /** Basic personal information. */ basics: BasicsItem; /** Array of certificate items. */ certificates: CertificateItem[]; /** Array of education history items. */ education: EducationItem[]; /** Array of interest items. */ interests: InterestItem[]; /** Array of language proficiency items. */ languages: LanguageItem[]; /** Location information. */ location: LocationItem; /** Array of project items. */ projects: ProjectItem[]; /** Array of online profile items. */ profiles: ProfileItem[]; /** Array of publication items. */ publications: PublicationItem[]; /** Array of reference items. */ references: ReferenceItem[]; /** Array of skill items. */ skills: SkillItem[]; /** Array of volunteer experience items. */ volunteer: VolunteerItem[]; /** Array of work experience items. */ work: WorkItem[]; computed?: { /** Translated names for each resume section based on locale. */ sectionNames?: { awards?: string; basics?: string; certificates?: string; education?: string; interests?: string; languages?: string; location?: string; projects?: string; profiles?: string; publications?: string; references?: string; skills?: string; volunteer?: string; work?: string; }; /** Combined and formatted string of URLs from basics and profiles. */ urls?: string; }; }; /** Defines the structure for page margin settings. */ type ResumeLayoutMargins = { /** Top margin value (e.g., "2.5cm"). */ top: string; /** Bottom margin value (e.g., "2.5cm"). */ bottom: string; /** Left margin value (e.g., "1.5cm"). */ left: string; /** Right margin value (e.g., "1.5cm"). */ right: string; }; /** The options for the font spec numbers style. */ declare const FONT_SPEC_NUMBERS_STYLE_OPTIONS: readonly ["Lining", "OldStyle", "Auto"]; /** * The type of font spec numbers style. * * - `Lining` - standard lining figures (default for CJK languages) * - `OldStyle` - old style figures with varying heights (default for Latin * languages) * - `Auto` - an undefined state, allowing the style to be automatically * determined based on the selected `LocaleLanguage` */ type FontSpecNumbersStyle = (typeof FONT_SPEC_NUMBERS_STYLE_OPTIONS)[number]; /** Defines typography settings like font size and number style. */ type ResumeLayoutTypography = { /** Base font size for the document (e.g., "10pt", "11pt"). */ fontSize: string; /** Font specification details. */ fontSpec: { /** Style for rendering numbers (Lining or OldStyle). */ numbers: FontSpecNumbersStyle; }; }; /** Defines locale settings, primarily the language for translations. */ type ResumeLayoutLocale = { /** The selected language for the resume content and template terms. */ language: LocaleLanguageOption; }; /** Defines page-level settings like page numbering. */ type ResumeLayoutPage = { /** Whether to display page numbers. */ showPageNumbers: boolean; }; /** Defines the selected template identifier. */ type ResumeTemplate = TemplateOption; /** Defines the overall layout configuration, including template, margins, * typography, locale, and computed environment settings. */ type ResumeLayout = { /** The selected template configuration. */ template: ResumeTemplate; /** Page margin settings. */ margins: ResumeLayoutMargins; /** Typography settings. */ typography: ResumeLayoutTypography; /** Localization settings. */ locale: ResumeLayoutLocale; /** Page-level settings. */ page: ResumeLayoutPage; }; /** * Represents the complete resume data structure, including metadata, content, * layout configuration, and build information. */ type Resume = { /** Unique identifier for the resume. */ id: string; /** User-defined title for the resume. */ title: string; /** URL-friendly identifier for the resume. */ slug: string; /** Contains all the textual and structured content of the resume sections. */ content: ResumeContent; /** Defines the visual appearance, template, and localization settings. */ layout: ResumeLayout; /** URL or path to the generated PDF file, if available. */ pdf: string; /** Timestamp indicating when the resume was created. */ createdAt: string; /** Timestamp indicating the last time the resume was updated. */ updatedAt: string; /** Timestamp indicating when the resume was published (if applicable). */ publishedAt: string; }; /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Defines all possible degrees. */ declare const DEGREE_OPTIONS: readonly ["Middle School", "High School", "Diploma", "Associate", "Bachelor", "Master", "Doctor"]; /** * Type for all possible degrees. */ type Degree = (typeof DEGREE_OPTIONS)[number]; /** * Defines common world languages. * * This list contains the most used languages in the world. * * TODO: allow users to add their own languages */ declare const LANGUAGE_OPTIONS: readonly ["Afrikaans", "Albanian", "Amharic", "Arabic", "Azerbaijani", "Belarusian", "Bengali", "Bhojpuri", "Bulgarian", "Burmese", "Cantonese", "Catalan", "Chinese", "Croatian", "Czech", "Danish", "Dutch", "English", "Estonian", "Farsi", "Filipino", "Finnish", "French", "German", "Greek", "Gujarati", "Hausa", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Igbo", "Indonesian", "Irish", "Italian", "Japanese", "Javanese", "Kazakh", "Khmer", "Korean", "Lahnda", "Latvian", "Lithuanian", "Malay", "Mandarin", "Marathi", "Nepali", "Norwegian", "Oromo", "Pashto", "Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Shona", "Sinhala", "Slovak", "Slovene", "Somali", "Spanish", "Sundanese", "Swahili", "Swedish", "Tagalog", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu", "Uzbek", "Vietnamese", "Yoruba", "Zulu"]; type Language = (typeof LANGUAGE_OPTIONS)[number]; /** * Defines language fluency levels. * * Based on the Interagency Language Roundtable (ILR) scale. */ declare const LANGUAGE_FLUENCIE_OPTIONS: readonly ["Elementary Proficiency", "Limited Working Proficiency", "Minimum Professional Proficiency", "Full Professional Proficiency", "Native or Bilingual Proficiency"]; type LanguageFluency = (typeof LANGUAGE_FLUENCIE_OPTIONS)[number]; /** * Defines skill proficiency levels. * * Based on common industry standards for skill assessment. */ declare const SKILL_LEVEL_OPTIONS: readonly ["Novice", "Beginner", "Intermediate", "Advanced", "Expert", "Master"]; type SkillLevel = (typeof SKILL_LEVEL_OPTIONS)[number]; /** Defines identifiers for the available resume templates. */ declare const TEMPLATE_OPTIONS: readonly ["moderncv-banking", "moderncv-casual", "moderncv-classic"]; type TemplateOption = (typeof TEMPLATE_OPTIONS)[number]; declare function getTemplateOptionDetail(templateOption: TemplateOption): { name: string; description: string; id: "moderncv-banking" | "moderncv-casual" | "moderncv-classic"; }; /** Provides default, empty item structures for each resume section type. */ declare const resumeItems: ResumeItem; /** Default content structure for a new resume, containing empty or minimal * sections. */ declare const defaultResumeContent: ResumeContent; /** * Resume content structure containing one example item for each section. * * Useful for testing transformations and rendering. */ declare const filledResumeContent: ResumeContent; /** Available font size options for resume layout. * * LaTeX only supports these values. */ declare const fontSizeOptions: string[]; /** Available margin size options for resume layout. */ declare const marginOptions: string[]; /** Defines supported languages for UI display and template translation. * * @see {@link https://en.wikipedia.org/wiki/IETF_language_tag} */ declare const LOCALE_LANGUAGE_OPTIONS: readonly ["en", "zh-hans", "zh-hant-hk", "zh-hant-tw", "es"]; /** Type for all possible locale languages. */ type LocaleLanguageOption = (typeof LOCALE_LANGUAGE_OPTIONS)[number]; /** * Get the language code and name of the given locale language. * * @param localeLanguage The locale language to get the name for. * @returns The language code and name of the given locale language. */ declare function getLocaleLanguageOptionDetail(localeLanguage: LocaleLanguageOption): { localeLanguage: "en" | "zh-hans" | "zh-hant-hk" | "zh-hant-tw" | "es"; name: string; }; /** Default layout configuration for a new resume. */ declare const defaultResumeLayout: ResumeLayout; /** Default value when user creates a new `Resume` object. */ declare const defaultResume: Resume; /** * Default value when user wants to use a filled resume. * * This is useful for testing transformations and rendering. */ declare const filledResume: Resume; /** * Enum of error codes for YAMLResumeError. * * Error codes are used to identify specific errors and can be used to * internationalize error messages. */ declare const ErrorType: { readonly FILE_NOT_FOUND: { readonly code: "FILE_NOT_FOUND"; readonly errno: number; readonly message: "Resume not found: {path}"; readonly path: ""; }; readonly FILE_READ_ERROR: { readonly code: "FILE_READ_ERROR"; readonly errno: number; readonly message: "Failed to read resume file: {path}"; readonly path: ""; }; readonly FILE_WRITE_ERROR: { readonly code: "FILE_WRITE_ERROR"; readonly errno: number; readonly message: "Failed to write file: {path}"; readonly path: ""; }; readonly FILE_CONFLICT: { readonly code: "FILE_CONFLICT"; readonly errno: number; readonly message: string; readonly path: ""; }; readonly INVALID_EXTNAME: { readonly code: "INVALID_EXTNAME"; readonly errno: number; readonly message: string; readonly extname: ""; }; readonly INVALID_YAML: { readonly code: "INVALID_YAML"; readonly errno: number; readonly message: "Invalid YAML format: {error}"; readonly error: ""; }; readonly INVALID_JSON: { readonly code: "INVALID_JSON"; readonly errno: number; readonly message: "Invalid JSON format: {error}"; readonly error: ""; }; readonly LATEX_NOT_FOUND: { readonly code: "LATEX_NOT_FOUND"; readonly errno: number; readonly message: "LaTeX compiler not found. Please install either xelatex or tectonic"; }; readonly LATEX_COMPILE_ERROR: { readonly code: "LATEX_COMPILE_ERROR"; readonly errno: number; readonly message: "LaTeX compilation failed: {error}"; readonly error: ""; }; }; /** * Type for the error code. */ type ErrorCodeType = keyof typeof ErrorType; /** * Type for the error message parameters. */ type ErrorMessageParams = { [K in ErrorCodeType]: { [P in keyof (typeof ErrorType)[K] as P extends 'message' | 'code' | 'errno' ? never : P]: string; }; }; /** * Custom error class for YAMLResume errors. */ declare class YAMLResumeError<T extends ErrorCodeType> extends Error { code: T; errno: number; /** * Constructor for YAMLResumeError. * * @param code - The error code. * @param params - The error message parameters. */ constructor(code: T, params: ErrorMessageParams[T]); } /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Applies all necessary transformations to a resume object in preparation for * rendering. * * This includes content processing, layout merging/adjustments, and environment * setup. * * The order of transformations is: content, layout, environment. * * @param resume - The original resume object. * @param summaryParser - The parser instance for handling summary fields. * @returns A new, transformed resume object ready for rendering. * @remarks This function operates on and returns a deep clone of the original * resume. */ declare function transformResume(resume: Resume, summaryParser: Parser): Resume; /** * MIT License * * Copyright (c) 2023–Present PPResume (https://ppresume.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * Abstract class for rendering resumes in TeX format. * * TeXRenderer provides the base functionality for converting Resume objects * into TeX documents. It follows a specific rendering order for resume * sections: * * 1. Core information (basics, location, profiles) * 2. Education and career (education, work) * 3. Languages and skills * 4. Paper works (awards, certificates, publications) * 5. Persons and projects (references, projects) * 6. Non-essential information (interests, volunteer) */ declare abstract class Renderer { resume: Resume; /** * Constructor for the Renderer class. * * @param resume - The resume to render. */ constructor(resume: Resume); /** * Render the preamble of the TeX document. * * @returns {string} The preamble of the TeX document. */ abstract renderPreamble(): string; /** * Render the basics section of the resume. * * @returns {string} The rendered basics section */ abstract renderBasics(): string; /** * Render the summary section of the resume. * * This method handles rendering the summary text stored in * resume.content.basics.summary. The summary is rendered separately from * other basic information since it may need to appear in a different location * in the output document depending on the template. * * @returns {string} The rendered summary section */ abstract renderSummary(): string; /** * Render the location section of the resume. * * @returns {string} The rendered location section */ abstract renderLocation(): string; /** * Render the profiles section of the resume. * * @returns {string} The rendered profiles section */ abstract renderProfiles(): string; /** * Render the education section of the resume. * * @returns {string} The rendered education section */ abstract renderEducation(): string; /** * Render the work section of the resume. * * @returns {string} The rendered work section */ abstract renderWork(): string; /** * Re