diff --git a/.cfformat.json b/.cfformat.json index 2bc723f..0233515 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -1,56 +1,62 @@ { - "array.empty_padding" : false, - "array.padding" : true, - "array.multiline.min_length" : 40, - "array.multiline.element_count" : 4, - "array.multiline.leading_comma.padding" : true, - "array.multiline.leading_comma" : false, - "alignment.consecutive.assignments" : true, - "alignment.consecutive.properties" : true, - "alignment.consecutive.params" : true, - "brackets.padding" : true, - "comment.asterisks" : "align", - "binary_operators.padding" : true, - "for_loop_semicolons.padding" : true, - "function_call.empty_padding" : false, - "function_call.padding" : true, - "function_call.multiline.leading_comma.padding" : true, - "function_call.casing.builtin" : "cfdocs", - "function_call.casing.userdefined" : "", - "function_call.multiline.element_count" : 4, - "function_call.multiline.leading_comma" : false, - "function_call.multiline.min_length" : 40, - "function_declaration.padding" : true, - "function_declaration.empty_padding" : false, - "function_declaration.multiline.leading_comma" : false, - "function_declaration.multiline.leading_comma.padding" : true, - "function_declaration.multiline.element_count" : 4, - "function_declaration.multiline.min_length" : 40, - "function_declaration.group_to_block_spacing" : "compact", - "function_anonymous.empty_padding" : false, - "function_anonymous.group_to_block_spacing" : "compact", - "function_anonymous.multiline.element_count" : 4, - "function_anonymous.multiline.leading_comma" : false, - "function_anonymous.multiline.leading_comma.padding" : true, - "function_anonymous.multiline.min_length" : 40, - "function_anonymous.padding" : true, - "indent_size" : 4, - "keywords.block_to_keyword_spacing" : "spaced", - "keywords.group_to_block_spacing" : "spaced", - "keywords.padding_inside_group" : true, - "keywords.spacing_to_block" : "spaced", - "keywords.spacing_to_group" : true, - "keywords.empty_group_spacing" : false, - "max_columns" : 120, - "parentheses.padding" : true, - "strings.quote" : "double", - "strings.attributes.quote" : "double", - "struct.separator" : " : ", - "struct.padding" : true, - "struct.empty_padding" : false, - "struct.multiline.leading_comma" : false, - "struct.multiline.leading_comma.padding" : true, - "struct.multiline.element_count" : 4, - "struct.multiline.min_length" : 40, - "tab_indent" : true + "array.empty_padding": false, + "array.padding": true, + "array.multiline.min_length": 40, + "array.multiline.element_count": 2, + "array.multiline.leading_comma.padding": true, + "array.multiline.leading_comma": false, + "alignment.consecutive.assignments": true, + "alignment.consecutive.properties": true, + "alignment.consecutive.params": true, + "brackets.padding": true, + "comment.asterisks": "align", + "binary_operators.padding": true, + "for_loop_semicolons.padding": true, + "function_call.empty_padding": false, + "function_call.padding": true, + "function_call.multiline.leading_comma.padding": true, + "function_call.casing.builtin": "cfdocs", + "function_call.casing.userdefined": "camel", + "function_call.multiline.element_count": 2, + "function_call.multiline.leading_comma": false, + "function_call.multiline.min_length": 40, + "function_declaration.padding": true, + "function_declaration.empty_padding": false, + "function_declaration.multiline.leading_comma": false, + "function_declaration.multiline.leading_comma.padding": true, + "function_declaration.multiline.element_count": 2, + "function_declaration.multiline.min_length": 40, + "function_declaration.group_to_block_spacing": "compact", + "function_anonymous.empty_padding": false, + "function_anonymous.group_to_block_spacing": "compact", + "function_anonymous.multiline.element_count": 2, + "function_anonymous.multiline.leading_comma": false, + "function_anonymous.multiline.leading_comma.padding": true, + "function_anonymous.multiline.min_length": 40, + "function_anonymous.padding": true, + "indent_size": 4, + "keywords.block_to_keyword_spacing": "spaced", + "keywords.group_to_block_spacing": "spaced", + "keywords.padding_inside_group": true, + "keywords.spacing_to_block": "spaced", + "keywords.spacing_to_group": true, + "keywords.empty_group_spacing": false, + "max_columns": 120, + "metadata.multiline.element_count": 3, + "metadata.multiline.min_length": 40, + "method_call.chain.multiline" : 3, + "newline":"\n", + "property.multiline.element_count": 3, + "property.multiline.min_length": 40, + "parentheses.padding": true, + "strings.quote": "double", + "strings.attributes.quote": "double", + "struct.separator": " : ", + "struct.padding": true, + "struct.empty_padding": false, + "struct.multiline.leading_comma": false, + "struct.multiline.leading_comma.padding": true, + "struct.multiline.element_count": 2, + "struct.multiline.min_length": 40, + "tab_indent": true } \ No newline at end of file diff --git a/.markdownlintrc.json b/.markdownlintrc.json new file mode 100644 index 0000000..ceacd1f --- /dev/null +++ b/.markdownlintrc.json @@ -0,0 +1,8 @@ +{ + "line-length": false, + "single-h1": false, + "first-line-h1": false, + "no-multiple-blanks": { + "maximum": 2 + } +} \ No newline at end of file diff --git a/.module.properties b/.module.properties deleted file mode 100644 index 8264f32..0000000 --- a/.module.properties +++ /dev/null @@ -1,3 +0,0 @@ -project.name=cbmarkdown -project.version=3.3.0 -module.name=cbmarkdown \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2822bf4..5a25a2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,20 +25,21 @@ sudo: required before_install: # CommandBox Keys - curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - - - sudo echo "deb https://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a + - sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a /etc/apt/sources.list.d/commandbox.list install: # Install Commandbox - sudo apt-get update && sudo apt-get --assume-yes install rsync jq commandbox # Install CommandBox Supporting Librarires - - box install commandbox-cfconfig,commandbox-dotenv,commandbox-docbox,commandbox-cfformat + - box install commandbox-cfconfig,commandbox-dotenv,commandbox-docbox # If using auto-publish, you will need to provide your API token with this line: - box config set endpoints.forgebox.APIToken=$FORGEBOX_API_TOKEN > /dev/null script: - # Set Current Version + # Set Current Version and Travis Tag - TARGET_VERSION=`cat $TRAVIS_BUILD_DIR/box.json | jq '.version' -r` + - TRAVIS_TAG=${TARGET_VERSION} - echo "Starting build for ${MODULE_ID} v${TARGET_VERSION}" # Replace version so builder can issue it - box package set version=@build.version@+@build.number@ @@ -54,12 +55,10 @@ script: #- curl http://localhost:60299/tests/runner.cfm?reporter=json -o testresults.json && cat testresults.json # move back to build dir to build it - cd $TRAVIS_BUILD_DIR - # Check formatting - - box run-script format:check # Build Project - box task run taskfile=build/Build target=run :version=${TARGET_VERSION} :projectName=${MODULE_ID} :buildID=${TRAVIS_BUILD_NUMBER} :branch=${TRAVIS_BRANCH} # Cat results for debugging - - cat build/results.json + #- cat build/results.json after_failure: - cd $TRAVIS_BUILD_DIR/test-harness @@ -102,9 +101,26 @@ deploy: upload-dir: coldbox-modules/$MODULE_ID/$TARGET_VERSION acl: public_read + # Github Release only on Master + - provider: releases + api_key: ${GITHUB_TOKEN} + on: + branch: + - master + condition: "$ENGINE = lucee@5" + skip_cleanup: true + edge: true + file_glob: true + file: $TRAVIS_BUILD_DIR/.artifacts/$MODULE_ID/**/* + release_notes_file: changelog.md + name: v${TRAVIS_TAG} + tag_name: v${TRAVIS_TAG} + overwrite: true + +# Once API Docs and Binaries are deployed to S3 Publish to ForgeBox after_deploy: # Move to build out artifact - cd ${TRAVIS_BUILD_DIR}/.tmp/${MODULE_ID} - cat box.json - # Only publish once + # Only publish once using the lucee matrix - if [ ${ENGINE} = 'lucee@5' ]; then box forgebox publish; fi diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 82a667c..c89936b 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -12,7 +12,7 @@ component { this.author = "Ortus Solutions, Corp"; this.webURL = "http://www.ortussolutions.com/products/codexwiki"; this.description = "Markdown processor for ColdBox applications"; - this.version = "@build.version@+@build.number@"; + this.version = "3.3.0+35"; // If true, looks for views in the parent first, if not found, then in the module. Else vice-versa this.viewParentLookup = true; // If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa @@ -27,7 +27,26 @@ component { */ function configure(){ settings = { - tableOptions : { + // Looks for www or emails and converts them to links + autoLinkUrls : true, + // Creates anchor links for headings + anchorLinks : true, + // Set the anchor id + anchorSetId : true, + // Set the anchor id but also the name + achorSetName : true, + // Do we create the anchor for the full header or just before it. True is wrap, false is just create anchor tag + anchorWrapText : false, + // The class(es) to apply to the anchor + anchorClass : "anchor", + // raw html prefix. Added before heading text, wrapped or unwrapped + anchorPrefix : "", + // raw html suffix. Added before heading text, wrapped or unwrapped + anchorSuffix : "", + // Enable youtube embedded link transformer + enableYouTubeTransformer : false, + // Table options + tableOptions : { // Treat consecutive pipes at the end of a column as defining spanning column. columnSpans : true, // Whether table body columns should be at least the number or header columns. diff --git a/box.json b/box.json index a2a315c..e9bf3da 100644 --- a/box.json +++ b/box.json @@ -29,9 +29,9 @@ "*/.md" ], "scripts":{ - "toMaster":"recipe build/toMaster.boxr", - "format":"cfformat ModuleConfig.cfc,models/**/*.cfc,test-harness/tests/specs/**/*.cfc --overwrite", - "format:watch":"cfformat ModuleConfig.cfc,models/**/*.cfc,test-harness/tests/specs/**/*.cfc --watch", - "format:check":"cfformat ModuleConfig.cfc,models/**/*.cfc,test-harness/tests/specs/**/*.cfc --check" + "release":"recipe build/release.boxr", + "format":"cfformat run models/,test-harness/tests/,*.cfc --overwrite", + "format:watch":"cfformat watch models/,test-harness/tests/,*.cfc ./.cfformat.json", + "format:check":"cfformat check models/,test-harness/tests/,*.cfc" } } \ No newline at end of file diff --git a/build/Build.cfc b/build/Build.cfc index 20d0623..20d86e4 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -78,7 +78,7 @@ component{ .toConsole(); } - /** + /** * Run the test suites */ function runTests(){ diff --git a/build/toMaster.boxr b/build/release.boxr similarity index 69% rename from build/toMaster.boxr rename to build/release.boxr index ec73706..e216f22 100755 --- a/build/toMaster.boxr +++ b/build/release.boxr @@ -1,19 +1,25 @@ # This recipe signifies a new release of the module by doing merges and bumps accordingly -# Check out master +# Check out master and update it locally !git checkout -f master -# Merge development into it +!git pull origin master + +# Merge development into it for release !git merge --no-ff development -# Tag the master repo with the version in box.json + +# Tag the master repo with the version from box.json !git tag v`box package show version` -# Push all branches + +# Push all branches back out to github !git push origin --all + # Push all tags !git push origin --tags + # Check development again !git checkout -f development + # Bump to prepare for a new release, do minor, change if needed and don't tag bump --minor --!tagVersion -# Send it out !git commit -a -m "version bump" !git push origin development \ No newline at end of file diff --git a/changelog.md b/changelog.md index 963269a..75ce071 100644 --- a/changelog.md +++ b/changelog.md @@ -1,34 +1,70 @@ -# CHANGELOG +# Changelog -## 3.3.0 +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +---- + +## [3.4.0] => 2020-MAY-28 + +### Added + +* Updated flexmark to 0.50.50 +* Added auto formatting thanks to cfformat +* Auto-publishing of changelos and artifacts to github upon release +* New Autolinking extension +* New Autoanchor extension +* New YouTube Transformer extension +* New TOC extension +* New TaskList extension +* New Strikethrough extension +* New Subscript extension + +---- + +## [3.3.0] => 2019-DEC-13 * New module layout * New flexmark core v0.50.44 thanks to @michaelborn -## 3.2.0 +---- + +## [3.2.0] => 2018-MAR-22 * Full Emoji support via the `cbemoji` library -## 3.1.0 +---- + +## [3.1.0] => 2018-MAR-08 * Dropped ACF10 support * Fixes the appending of user options instead of default options always taking precedence * Added accessors to Processor so you can retrieve internal parser and renderer -## 3.0.0 +---- + +## [3.0.0] => 2017-JUL-26 * Updated entire core to use Flexmark markdown processor * Added global options for processor -## 2.0.1 +---- + +## [2.0.1] * Unified workbench * Updated javaloader -## 2.0.0 +---- + +## [2.0.0] * Updated internal markdown Java library to txtmark: https://github.com/rjeschke/txtmark -## 1.0.0 +---- + +## [1.0.0] * Create first module version \ No newline at end of file diff --git a/models/Processor.cfc b/models/Processor.cfc index 2dd0839..3e0dae3 100644 --- a/models/Processor.cfc +++ b/models/Processor.cfc @@ -29,18 +29,23 @@ component accessors=true singleton { * @options The module options * @options.inject coldbox:modulesettings:cbmarkdown */ - function init( required javaloader, required struct options ){ + function init( + required javaloader, + required struct options + ){ // store references variables.javaloader = arguments.javaLoader; - variables.staticParser = javaloader.create( "com.vladsch.flexmark.parser.Parser" ); + variables.StaticParser = javaloader.create( "com.vladsch.flexmark.parser.Parser" ); + variables.HtmlRenderer = javaloader.create( "com.vladsch.flexmark.html.HtmlRenderer" ); - // Build out builder with options - var parserOptions = createOptions( arguments.options ); - variables.parser = staticParser.builder( parserOptions ).build(); - variables.renderer = javaloader - .create( "com.vladsch.flexmark.html.HtmlRenderer" ) + var parserOptions = createOptions( arguments.options ); + variables.parser = StaticParser.builder( parserOptions ).build(); + variables.renderer = HtmlRenderer.builder( parserOptions ).build(); + variables.htmlToMarkdown = javaLoader + .create( "com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter" ) .builder( parserOptions ) .build(); + return this; } @@ -53,6 +58,14 @@ component accessors=true singleton { return emojiService.emojify( trim( variables.renderer.render( document ) ) ); } + /** + * Convert HTML to Markdown + * @html The html to convert to markdown + */ + function toMarkdown( required html ){ + return variables.htmlToMarkdown.convert( trim( arguments.html ) ); + } + /** * Create a parser options object for the FlexMark parser. * @@ -61,52 +74,115 @@ component accessors=true singleton { * @return A parser options object. */ private function createOptions( required struct options ){ - structAppend( arguments.options, defaultOptions(), false ); - var staticTableExtension = javaloader.create( "com.vladsch.flexmark.ext.tables.TablesExtension" ); + var anchorLinkExtension = javaloader.create( "com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension" ); + + var extensionsToLoad = [ + staticTableExtension.create(), + javaloader.create( "com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughSubscriptExtension" ).create(), + javaloader.create( "com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension" ).create(), + javaloader.create( "com.vladsch.flexmark.ext.toc.TocExtension" ).create() + ]; + + // autoLinkUrls + if ( arguments.options.autoLinkUrls ) { + extensionsToLoad.append( + javaloader.create( "com.vladsch.flexmark.ext.autolink.AutolinkExtension" ).create() + ); + } + // AnchorLinks + if ( arguments.options.anchorLinks ) { + extensionsToLoad.append( anchorLinkExtension.create() ); + } + // Youtube Transformer + if ( arguments.options.enableYouTubeTransformer ) { + extensionsToLoad.append( + javaloader.create( "com.vladsch.flexmark.ext.youtube.embedded.YouTubeLinkExtension" ).create() + ); + } + return javaloader .create( "com.vladsch.flexmark.util.data.MutableDataSet" ) .init() + // Autolink + Anchor Link Options + .set( + variables.StaticParser.WWW_AUTO_LINK_ELEMENT, + javacast( + "boolean", + arguments.options.autoLinkUrls + ) + ) + .set( + anchorLinkExtension.ANCHORLINKS_SET_ID, + javacast( + "boolean", + arguments.options.anchorSetId + ) + ) + .set( + anchorLinkExtension.ANCHORLINKS_SET_NAME, + javacast( + "boolean", + arguments.options.achorSetName + ) + ) + .set( + anchorLinkExtension.ANCHORLINKS_WRAP_TEXT, + javacast( + "boolean", + arguments.options.anchorWrapText + ) + ) + .set( + anchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, + arguments.options.anchorClass + ) + .set( + anchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, + arguments.options.anchorPrefix + ) + .set( + anchorLinkExtension.ANCHORLINKS_TEXT_SUFFIX, + arguments.options.anchorSuffix + ) + // Add Table Options .set( staticTableExtension.COLUMN_SPANS, - javacast( "boolean", arguments.options.tableOptions.columnSpans ) + javacast( + "boolean", + arguments.options.tableOptions.columnSpans + ) ) .set( staticTableExtension.APPEND_MISSING_COLUMNS, - javacast( "boolean", arguments.options.tableOptions.appendMissingColumns ) + javacast( + "boolean", + arguments.options.tableOptions.appendMissingColumns + ) ) .set( staticTableExtension.DISCARD_EXTRA_COLUMNS, - javacast( "boolean", arguments.options.tableOptions.discardExtraColumns ) + javacast( + "boolean", + arguments.options.tableOptions.discardExtraColumns + ) + ) + .set( + staticTableExtension.CLASS_NAME, + arguments.options.tableOptions.className ) - .set( staticTableExtension.CLASS_NAME, arguments.options.tableOptions.className ) .set( staticTableExtension.HEADER_SEPARATOR_COLUMN_MATCH, - javacast( "boolean", arguments.options.tableOptions.headerSeparationColumnMatch ) + javacast( + "boolean", + arguments.options.tableOptions.headerSeparationColumnMatch + ) ) - .set( variables.staticParser.EXTENSIONS, [ staticTableExtension.create() ] ); - } - - /** - * Return the default parser options to merge with the user's options. - * - * @return The default parser options struct. - */ - private struct function defaultOptions(){ - return { - tableOptions : { - // Treat consecutive pipes at the end of a column as defining spanning column. - columnSpans : true, - // Whether table body columns should be at least the number or header columns. - appendMissingColumns : true, - // Whether to discard body columns that are beyond what is defined in the header - discardExtraColumns : true, - // Class name to use on tables - className : "table", - // When true only tables whose header lines contain the same number of columns as the separator line will be recognized - headerSeparationColumnMatch : true - } - }; + // Load extensions + .set( + variables.StaticParser.EXTENSIONS, + extensionsToLoad + ); } } diff --git a/models/lib/autolink-0.6.0.jar b/models/lib/autolink-0.6.0.jar new file mode 100644 index 0000000..b68eb91 Binary files /dev/null and b/models/lib/autolink-0.6.0.jar differ diff --git a/models/lib/flexmark-0.50.44.jar b/models/lib/flexmark-0.50.50.jar similarity index 77% rename from models/lib/flexmark-0.50.44.jar rename to models/lib/flexmark-0.50.50.jar index 9bf1ed8..9ad6f08 100644 Binary files a/models/lib/flexmark-0.50.44.jar and b/models/lib/flexmark-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-anchorlink-0.50.50.jar b/models/lib/flexmark-ext-anchorlink-0.50.50.jar new file mode 100644 index 0000000..96bd76e Binary files /dev/null and b/models/lib/flexmark-ext-anchorlink-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-autolink-0.50.50.jar b/models/lib/flexmark-ext-autolink-0.50.50.jar new file mode 100644 index 0000000..7e02f20 Binary files /dev/null and b/models/lib/flexmark-ext-autolink-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-gfm-strikethrough-0.50.50.jar b/models/lib/flexmark-ext-gfm-strikethrough-0.50.50.jar new file mode 100644 index 0000000..0c35bee Binary files /dev/null and b/models/lib/flexmark-ext-gfm-strikethrough-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-gfm-tables-0.50.44.jar b/models/lib/flexmark-ext-gfm-tables-0.50.50.jar similarity index 81% rename from models/lib/flexmark-ext-gfm-tables-0.50.44.jar rename to models/lib/flexmark-ext-gfm-tables-0.50.50.jar index 523594d..b6629a7 100644 Binary files a/models/lib/flexmark-ext-gfm-tables-0.50.44.jar and b/models/lib/flexmark-ext-gfm-tables-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-gfm-tasklist-0.50.50.jar b/models/lib/flexmark-ext-gfm-tasklist-0.50.50.jar new file mode 100644 index 0000000..44b1776 Binary files /dev/null and b/models/lib/flexmark-ext-gfm-tasklist-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-tables-0.50.44.jar b/models/lib/flexmark-ext-tables-0.50.50.jar similarity index 86% rename from models/lib/flexmark-ext-tables-0.50.44.jar rename to models/lib/flexmark-ext-tables-0.50.50.jar index dda6291..a060348 100644 Binary files a/models/lib/flexmark-ext-tables-0.50.44.jar and b/models/lib/flexmark-ext-tables-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-toc-0.50.50.jar b/models/lib/flexmark-ext-toc-0.50.50.jar new file mode 100644 index 0000000..063074c Binary files /dev/null and b/models/lib/flexmark-ext-toc-0.50.50.jar differ diff --git a/models/lib/flexmark-ext-youtube-embedded-0.50.50.jar b/models/lib/flexmark-ext-youtube-embedded-0.50.50.jar new file mode 100644 index 0000000..6b26a35 Binary files /dev/null and b/models/lib/flexmark-ext-youtube-embedded-0.50.50.jar differ diff --git a/models/lib/flexmark-formatter-0.50.44.jar b/models/lib/flexmark-formatter-0.50.50.jar similarity index 91% rename from models/lib/flexmark-formatter-0.50.44.jar rename to models/lib/flexmark-formatter-0.50.50.jar index 489ec10..877ef71 100644 Binary files a/models/lib/flexmark-formatter-0.50.44.jar and b/models/lib/flexmark-formatter-0.50.50.jar differ diff --git a/models/lib/flexmark-html-parser-0.50.50.jar b/models/lib/flexmark-html-parser-0.50.50.jar new file mode 100644 index 0000000..0c4bf2c Binary files /dev/null and b/models/lib/flexmark-html-parser-0.50.50.jar differ diff --git a/models/lib/flexmark-html2md-converter-0.50.50.jar b/models/lib/flexmark-html2md-converter-0.50.50.jar new file mode 100644 index 0000000..1fd34aa Binary files /dev/null and b/models/lib/flexmark-html2md-converter-0.50.50.jar differ diff --git a/models/lib/flexmark-util-0.50.44.jar b/models/lib/flexmark-util-0.50.50.jar similarity index 91% rename from models/lib/flexmark-util-0.50.44.jar rename to models/lib/flexmark-util-0.50.50.jar index 9c193d6..887e207 100644 Binary files a/models/lib/flexmark-util-0.50.44.jar and b/models/lib/flexmark-util-0.50.50.jar differ diff --git a/models/lib/jsoup-1.11.3.jar b/models/lib/jsoup-1.11.3.jar new file mode 100644 index 0000000..962e355 Binary files /dev/null and b/models/lib/jsoup-1.11.3.jar differ diff --git a/readme.md b/readme.md index 7b1468c..774bd02 100644 --- a/readme.md +++ b/readme.md @@ -31,6 +31,10 @@ The module registers the following mapping in WireBox: `Processor@cbmarkdown`. W * `toHTML( required txt )` - Convert markdown text to HTML. +### HTML to Markdown + +You can also use our `toMarkdown()` function to convert any HTML to markdown equivalent. + ## Options A subset of the flexmark options are supported. These can be configured in your module settings in your `config/Coldbox.cfc` via the `modulesettings` struct. @@ -38,19 +42,38 @@ A subset of the flexmark options are supported. These can be configured in your ``` moduleSettings = { cbmarkdown = { - tableOptions = { + // Looks for www or emails and converts them to links + autoLinkUrls : true, + // Creates anchor links for headings + anchorLinks : true, + // Set the anchor id + anchorSetId : true, + // Set the anchor id but also the name + achorSetName : true, + // Do we create the anchor for the full header or just before it. True is wrap, false is just create anchor tag + anchorWrapText : false, + // The class(es) to apply to the anchor + anchorClass : "anchor", + // raw html prefix. Added before heading text, wrapped or unwrapped + anchorPrefix : "", + // raw html suffix. Added before heading text, wrapped or unwrapped + anchorSuffix : "", + // Enable youtube embedded link transformer + enableYouTubeTransformer : false, + // Table options + tableOptions : { // Treat consecutive pipes at the end of a column as defining spanning column. - columnSpans = true, + columnSpans : true, // Whether table body columns should be at least the number or header columns. - appendMissingColumns = true, + appendMissingColumns : true, // Whether to discard body columns that are beyond what is defined in the header - discardExtraColumns = true, + discardExtraColumns : true, // Class name to use on tables - className = "table", + className : "table", // When true only tables whose header lines contain the same number of columns as the separator line will be recognized - headerSeparationColumnMatch = true + headerSeparationColumnMatch : true } - } + } // end markdown settings }; ``` @@ -59,7 +82,7 @@ Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com ******************************************************************************** -#### HONOR GOES TO GOD ABOVE ALL +### HONOR GOES TO GOD ABOVE ALL Because of His grace, this project exists. If you don't like this, then don't read it, its not for you. diff --git a/test-harness/box.json b/test-harness/box.json index 19e671f..6d08acf 100644 --- a/test-harness/box.json +++ b/test-harness/box.json @@ -10,7 +10,7 @@ "cbemoji":"^1.1.0+16" }, "devDependencies":{ - "testbox":"^3.0.0" + "testbox":"^4.0.0" }, "installPaths":{ "coldbox":"coldbox/", diff --git a/test-harness/tests/specs/LoaderTest.cfc b/test-harness/tests/specs/LoaderTest.cfc index 50812fb..aace217 100644 --- a/test-harness/tests/specs/LoaderTest.cfc +++ b/test-harness/tests/specs/LoaderTest.cfc @@ -32,6 +32,7 @@ component extends="coldbox.system.testing.BaseTestCase" appMapping="/root" { it( "should process markdown", function(){ var event = execute( event = "main.index" ); var prc = event.getPrivateCollection(); + expect( prc.html ).toInclude( "Introduction" ); } ); } );