Crate somedoc
A very simple document model and markup generator.
Model
The somedoc::model module provides the model to construct documents.
Example
Writers
The somedoc::write module contains a number of serializers that generate specific markup for different platforms.
Example
The following writes a constructed document to stdout as a Markdown document. The default flavor supported by
the writer is the CommonMark spec.
use write_document_to_string;
use MarkdownFlavor;
let doc = make_some_document;
let doc_str = write_document_to_string.unwrap;
println!;
The following writes the same document out in the XWiki markup form.
use ;
let doc = make_some_document;
let doc_str = write_document_to_string.unwrap;
println!;
Changes
Version 0.2.3
- Added: JSON writer
- Added a feature
fmt_json. - Added dependencies on
serdeandserde_json. - Also added a
versionfield to theDocumentto allow for tool checking, this will be the crate version on write. - All structures now support
Serialize/Deserializefor Serde
- Added a feature
- Added JSON reader using the same Serde support.
Version 0.2.2
- Added: mostly complete API/library documentation.
- Added:
inner_implmacro for consistent use ofinnerandinto_innermethods.- Refactor: this required renaming
linktoinneronImage.
- Refactor: this required renaming
- Fixed: Duplicate
Fromandfromimplementations on inline content. - Refactor: renamed
labeltotextonmodel::block::table::Column. - Refactor: renamed
Captionedtrait toHasCaptionfor consistency. - Refactor: replaced
TextwithCaptionas type forHyperLinkcaption; implementedHasCaptionalso. - Refactor: made definition lists only a single level, and the term is simply a
String. - Refactor: removed constructors that only took a single value and use
From<>instead inCaption,Code,Formatted,Heading,Image. - Refactor: renaming
new_with_functions to simplywith_. - Refactor: removed
ParagraphStyle, madealignmenta single value property onParagraph.- Moved the Alignment enum to its own module shared with
Paragraphandtable::Column. - Added new
HasAlignmenttrait (and macro) for consistency between paragraph and column.
- Moved the Alignment enum to its own module shared with
- Clean-up: fixed all Clippy warnings.
Version 0.2.1
This is a significant update, some APIs will have changed, but the plan is that these new API forms will be stabilized toward a 0.3.0 release that can be relied on for non-breaking changes.
- Added: additional features in the HTML writer. It should be complete pending testing.
- Added: complete writer implementation for LaTeX. It should be complete pending testing.
- Added: configuration features for each writer,
fmt_html,fmt_latex, fmt_markdown`, etc. with the default feature including all of these. - Added:
Writer, andConfigurableWriterto thewritemodule to capture the instantiation of a writer struct. - Added: more library/API documentation, but not all yet.
- Refactor: combined all markdown-like formats into a common module.
- Refactor: moved the
Anchortype to a newLabel, it is no longer a stand-alone inline value, but has been added as a property to most block types. - Refactor: moved
Abstractout of theMetadataenum and made it a property of the document proper. This also affects the visitor API. - Refactor: renamed
label/alt_textonHyperLinktocaption. - Clean-up: made the document API easier, removing
Result<>where it wasn't needed. - Clean-up: removed the unused dependency on
log. - Testing: added dependency on
pretty_assertionsfor better comparison of test failures. - Testing: creating test cases across formats.
Version 0.2.0
- Added: new visitor traits and migrated the
XWikiwriter to use it. - Added: new HTML writer using the new visitor traits.
- Added: new
Math(inline), andMathBlock(block) constructs. - Added: new
Captiontype and implementation forCode,MathBlock, andTable. - Added:
Dereffor some String newtypes (Anchor,Caption,Emoji, andText). - Testing: using
proptestfor the String newtypes listed above.
Version 0.1.7
- Fixed: fixed a bug in HeadingLevel/markdown generation.
Version 0.1.6
- Added: started on library documentation.
- Added:
model::inline::emoji_namesmodule, but only enabled foremoji_namesfeature. - Added:
readme_makerexample, this is used in the README and lib.rs documentation. - Fixed: fixed a bug in XWiki
write_codefunction. - Refactor: document metadata, and Markdown writer accordingly.
- Refactor: renamed
TextStyle->SpanStyle, addedSizedvariant. - Clean-up: the
readmodule as it was currently empty. - Clean-up: femoved the
model::visitormodule, too many changes to stabilize yet. - Testing: some initial test cases.
Version 0.1.5 (not published)
- Added some more replacement rules for XWiki anchors.
Version 0.1.4
- Moved the rules for formatting an
Anchorinto each writer.
Version 0.1.3
- Added
FormattedalongsideCodeBlock. - Removed some additional blank lines from both Markdown and XWiki writers.
Version 0.1.2
- Fixed nested list bug in XWiki writer.
Version 0.1.1
- Added cargo-husky for git hooks.
- Fixed bug in tables for XWiki writer.
Version 0.1.0
- Initial commit. Basic model working, initial Markdown and XWiki writers.
TODO
- Investigate math support in some form.
- Investigate float hints.
- Investigate glossary, acronym, and bib support.