Skip to content

Commit

Permalink
feat: update showdown options for current options
Browse files Browse the repository at this point in the history
add: backslashEscapesHTMLTags, rawHeaderId, rawPrefixHeaderId
  • Loading branch information
yisraelx committed Aug 31, 2017
1 parent 76736ea commit 8f91b65
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ console.log(\`sum: \${sum}\`);

options: IConverterOptionsChangeable = {
customizedHeaderId: false,
backslashEscapesHTMLTags: false,
disableForced4SpacesIndentedSublists: false,
encodeEmails: true,
excludeTrailingPunctuationFromURLs: false,
Expand All @@ -34,6 +35,8 @@ console.log(\`sum: \${sum}\`);
openLinksInNewWindow: false,
parseImgDimensions: false,
prefixHeaderId: false,
rawHeaderId: false,
rawPrefixHeaderId: false,
requireSpaceBeforeHeadingText: false,
simpleLineBreaks: false,
simplifiedAutoLink: false,
Expand Down
2 changes: 2 additions & 0 deletions demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
MdInputModule,
MdSlideToggleModule,
Expand All @@ -17,6 +18,7 @@ import { ShowdownModule } from '../../../src';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ShowdownModule,
// material
Expand Down
6 changes: 6 additions & 0 deletions src/base-converter-options.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IConverterOptions } from './base-converter.class';
export class ConverterOptions {

customizedHeaderId: boolean;
backslashEscapesHTMLTags: boolean;
disableForced4SpacesIndentedSublists: boolean;
encodeEmails: boolean;
excludeTrailingPunctuationFromURLs: boolean;
Expand All @@ -20,6 +21,8 @@ export class ConverterOptions {
openLinksInNewWindow: boolean;
parseImgDimensions: boolean;
prefixHeaderId: string | boolean;
rawHeaderId: boolean;
rawPrefixHeaderId: boolean;
requireSpaceBeforeHeadingText: boolean;
simpleLineBreaks: boolean;
simplifiedAutoLink: boolean;
Expand Down Expand Up @@ -66,6 +69,7 @@ export class BaseConverterOptions extends ConverterOptions {
constructor() {
super({
customizedHeaderId: false,
backslashEscapesHTMLTags: false,
disableForced4SpacesIndentedSublists: false,
encodeEmails: true,
excludeTrailingPunctuationFromURLs: false,
Expand All @@ -82,6 +86,8 @@ export class BaseConverterOptions extends ConverterOptions {
openLinksInNewWindow: false,
parseImgDimensions: false,
prefixHeaderId: false,
rawHeaderId: false,
rawPrefixHeaderId: false,
requireSpaceBeforeHeadingText: false,
simpleLineBreaks: false,
simplifiedAutoLink: false,
Expand Down
5 changes: 4 additions & 1 deletion src/base-converter.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import $ from './utils';
import { ConverterOptions } from './base-converter-options.provider';

export interface IConverterOptionsChangeable {
customizedHeaderId?: boolean;
customizedHeaderId?: boolean;
backslashEscapesHTMLTags?: boolean;
disableForced4SpacesIndentedSublists?: boolean;
encodeEmails?: boolean;
excludeTrailingPunctuationFromURLs?: boolean;
Expand All @@ -19,6 +20,8 @@ export interface IConverterOptionsChangeable {
openLinksInNewWindow?: boolean;
parseImgDimensions?: boolean;
prefixHeaderId?: string | boolean;
rawHeaderId?: boolean;
rawPrefixHeaderId?: boolean;
requireSpaceBeforeHeadingText?: boolean;
simpleLineBreaks?: boolean;
simplifiedAutoLink?: boolean;
Expand Down
9 changes: 6 additions & 3 deletions src/showdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConverterOptions } from './base-converter-options.provider';
import { BaseConverter, IConverterOptionsChangeable } from './base-converter.class';

let optionsProperties: string[] = [
'customizedHeaderId', 'disableForced4SpacesIndentedSublists', 'encodeEmails', 'excludeTrailingPunctuationFromURLs', 'ghCodeBlocks', 'ghCompatibleHeaderId', 'ghMentions', 'ghMentionsLink', 'headerLevelStart', 'literalMidWordAsterisks', 'literalMidWordUnderscores', 'noHeaderId', 'omitExtraWLInCodeBlocks', 'openLinksInNewWindow', 'parseImgDimensions', 'prefixHeaderId', 'requireSpaceBeforeHeadingText', 'simpleLineBreaks', 'simplifiedAutoLink', 'smartIndentationFix', 'smoothLivePreview', 'strikethrough', 'tables', 'tablesHeaderId', 'tasklists', 'trimEachLine'
'customizedHeaderId', 'backslashEscapesHTMLTags', 'disableForced4SpacesIndentedSublists', 'encodeEmails', 'excludeTrailingPunctuationFromURLs', 'ghCodeBlocks', 'ghCompatibleHeaderId', 'ghMentions', 'ghMentionsLink', 'headerLevelStart', 'literalMidWordAsterisks', 'literalMidWordUnderscores', 'noHeaderId', 'omitExtraWLInCodeBlocks', 'openLinksInNewWindow', 'parseImgDimensions', 'prefixHeaderId', 'rawHeaderId', 'rawPrefixHeaderId', 'requireSpaceBeforeHeadingText', 'simpleLineBreaks', 'simplifiedAutoLink', 'smartIndentationFix', 'smoothLivePreview', 'strikethrough', 'tables', 'tablesHeaderId', 'tasklists', 'trimEachLine'
];

export enum SHOWDOWN_DIRECTIVE_TYPES {
Expand Down Expand Up @@ -74,6 +74,7 @@ export class ShowdownDirective extends BaseConverter implements OnInit {

// options getter setter dynamic definition (the code after the class)
public customizedHeaderId?: boolean;
public backslashEscapesHTMLTags?: boolean;
public disableForced4SpacesIndentedSublists?: boolean;
public encodeEmails?: boolean;
public excludeTrailingPunctuationFromURLs?: boolean;
Expand All @@ -89,6 +90,8 @@ export class ShowdownDirective extends BaseConverter implements OnInit {
public openLinksInNewWindow?: boolean;
public parseImgDimensions?: boolean;
public prefixHeaderId?: string | boolean;
public rawHeaderId?: boolean;
public rawPrefixHeaderId?: boolean;
public requireSpaceBeforeHeadingText?: boolean;
public simpleLineBreaks?: boolean;
public simplifiedAutoLink?: boolean;
Expand Down Expand Up @@ -205,10 +208,10 @@ export class ShowdownDirective extends BaseConverter implements OnInit {
// define options properties getter setter for angular directive and direct access
optionsProperties.forEach((key: string) => {
Object.defineProperty(ShowdownDirective.prototype, key, {
set(value: any): void {
set (value: any): void {
this.setOption(key, $.isEmpty(value) ? true : value);
},
get(): any {
get (): any {
return this.getOption(key);
},
enumerable: true,
Expand Down

0 comments on commit 8f91b65

Please sign in to comment.