🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

html-to-document-core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-document-core - npm Package Compare versions

Comparing version

to
0.3.0

11

CHANGELOG.md

@@ -0,1 +1,7 @@

## <small>0.3.0 (2025-06-08)</small>
* docs: document headers and update docx adapter guide (#13) ([b9c42e0](https://github.com/ChipiKaf/html-to-document/commit/b9c42e0)), closes [#13](https://github.com/ChipiKaf/html-to-document/issues/13)
* Add page sections and headers to docx adapter (#11) ([2f190c6](https://github.com/ChipiKaf/html-to-document/commit/2f190c6)), closes [#11](https://github.com/ChipiKaf/html-to-document/issues/11)
* Fix built-in docx adapter (#10) ([25ec976](https://github.com/ChipiKaf/html-to-document/commit/25ec976)), closes [#10](https://github.com/ChipiKaf/html-to-document/issues/10)
## <small>0.2.9 (2025-06-07)</small>

@@ -5,7 +11,2 @@

# Changelog
## [0.2.8] - 2025-06-04

@@ -12,0 +13,0 @@

@@ -364,2 +364,14 @@ import { extractAttributesToMetadata, parseAttributes, parseStyles, } from './utils/html.utils';

};
case 'header':
return { type: 'header', text, content: children, ...options };
case 'footer':
return { type: 'footer', text, content: children, ...options };
case 'section':
if (element.classList.contains('page-break')) {
return { type: 'page-break', ...options };
}
if (element.classList.contains('page')) {
return { type: 'page', text, content: children, ...options };
}
return { type: 'fragment', text, content: children, ...options };
case 'span':

@@ -366,0 +378,0 @@ case 'a':

@@ -33,3 +33,3 @@ import * as CSS from 'csstype';

*/
export type ElementType = 'paragraph' | 'heading' | 'image' | 'text' | 'line' | 'list' | 'list-item' | 'table' | 'table-row' | 'table-cell' | 'fragment' | 'attribute' | (string & {});
export type ElementType = 'paragraph' | 'heading' | 'image' | 'text' | 'line' | 'list' | 'list-item' | 'table' | 'table-row' | 'table-cell' | 'page' | 'page-break' | 'header' | 'footer' | 'fragment' | 'attribute' | (string & {});
/**

@@ -118,5 +118,26 @@ * Represents a paragraph element, optionally containing text and/or child elements.

/**
* Represents a logical page section which may contain its own header and footer.
*/
export interface PageElement extends BaseElement {
type: 'page';
content?: DocumentElement[];
}
/** Represents a page break. */
export interface PageBreakElement extends BaseElement {
type: 'page-break';
}
/** Represents a document header element. */
export interface HeaderElement extends BaseElement {
type: 'header';
content?: DocumentElement[];
}
/** Represents a document footer element. */
export interface FooterElement extends BaseElement {
type: 'footer';
content?: DocumentElement[];
}
/**
* Union of all supported document element types in the intermediate representation.
*/
export type DocumentElement = ParagraphElement | HeadingElement | ImageElement | ListElement | ListItemElement | TableElement | LineElement | TextElement | TableRowElement | TableCellElement | FragmentElement | AttributeElement | (BaseElement & {
export type DocumentElement = ParagraphElement | HeadingElement | ImageElement | ListElement | ListItemElement | TableElement | LineElement | TextElement | TableRowElement | TableCellElement | PageElement | PageBreakElement | HeaderElement | FooterElement | FragmentElement | AttributeElement | (BaseElement & {
type: ElementType;

@@ -123,0 +144,0 @@ });

@@ -111,2 +111,14 @@ /**

break;
case 'header':
tagName = 'header';
break;
case 'footer':
tagName = 'footer';
break;
case 'page':
tagName = 'section';
break;
case 'page-break':
tagName = 'section';
break;
case 'table-row':

@@ -113,0 +125,0 @@ tagName = 'tr';

{
"name": "html-to-document-core",
"version": "0.2.9",
"version": "0.3.0",
"description": "Core engine that parses HTML into an intermediate DocumentElement tree and exposes a plugin registry so external adapters can convert that tree into DOCX, PDF, XLSX, Markdown and more.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet