#![doc = include_str!("readme.md")]
use oak_core::{Language, LanguageCategory};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct MarkdownLanguage {
pub allow_math: bool,
pub allow_tables: bool,
pub allow_task_lists: bool,
pub allow_strikethrough: bool,
pub allow_footnotes: bool,
pub allow_front_matter: bool,
pub allow_definition_lists: bool,
pub allow_subscript: bool,
pub allow_autolinks: bool,
pub allow_abbreviations: bool,
pub allow_indented_code_blocks: bool,
pub allow_html: bool,
pub allow_hard_line_breaks: bool,
pub allow_gfm_autolinks: bool,
pub allow_headings: bool,
pub allow_lists: bool,
pub allow_blockquotes: bool,
pub allow_fenced_code_blocks: bool,
pub allow_horizontal_rules: bool,
pub allow_setext_headings: bool,
pub allow_html_tagfilter: bool,
pub allow_xml: bool,
}
impl MarkdownLanguage {
pub fn new() -> Self {
Self::default()
}
}
impl Language for MarkdownLanguage {
const NAME: &'static str = "markdown";
const CATEGORY: LanguageCategory = LanguageCategory::Markup;
type TokenType = crate::lexer::token_type::MarkdownTokenType;
type ElementType = crate::parser::element_type::MarkdownElementType;
type TypedRoot = crate::ast::MarkdownRoot;
}
impl Default for MarkdownLanguage {
fn default() -> Self {
Self {
allow_math: true,
allow_tables: true,
allow_task_lists: true,
allow_strikethrough: true,
allow_footnotes: true,
allow_front_matter: true,
allow_definition_lists: false,
allow_subscript: false,
allow_autolinks: true,
allow_abbreviations: true,
allow_indented_code_blocks: true,
allow_html: true,
allow_hard_line_breaks: true,
allow_gfm_autolinks: true,
allow_headings: true,
allow_lists: true,
allow_blockquotes: true,
allow_fenced_code_blocks: true,
allow_horizontal_rules: true,
allow_setext_headings: true,
allow_html_tagfilter: false,
allow_xml: false,
}
}
}