//! HTML and Vue, ported from Prettier's `src/language-html` by way of bun's port.
//!
//! ```text
//! text ─ lexer ─→ tokens ─ parser, parse ─→ tree ─ preprocess ─→ white space sensitivity ─ printer ─→ doc
//! ```
mod ast;
mod data;
mod embed;
mod entities;
mod error;
mod lexer;
mod parse;
mod parser;
mod preprocess;
mod print;
mod strings;
mod tag;
mod utilities;
/// How deep elements may nest before formatting gives up, rather than overflow the stack.
const MAX_DEPTH: u32 = 1000;
/// Prettier's `parser` option.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Parser {
Html,
Vue,
Angular,
Lwc,
Mjml,
}
/// Prettier's `htmlWhitespaceSensitivity`.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
pub enum Whitespace {
/// Decided by the default value of the CSS property `display`.
#[default]
Css,
/// All of it.
Strict,
/// None of it.
Ignore,
}
/// The `options` that Prettier's functions receive.
pub(crate) struct Options<'o> {
pub(crate) parser: Parser,
/// `originalText`, where every line break is `\n`.
pub(crate) original_text: &'o [u8],
pub(crate) whitespace: Whitespace,
pub(crate) filepath: Option<&'o [u8]>,
pub(crate) width: usize,
pub(crate) tab_width: usize,
pub(crate) single_attribute_per_line: bool,
pub(crate) bracket_same_line: bool,
pub(crate) vue_indent_script_and_style: bool,
/// `parentParser`: the text is embedded in another language.
pub(crate) embedded: bool,
/// A Vue file with a TypeScript `