Skip to content

Commit a794680

Browse files
committed
configuable plantUML server address
1 parent d6c3490 commit a794680

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

browser/lib/markdown.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ class Markdown {
145145
const deflate = require('markdown-it-plantuml/lib/deflate')
146146
this.md.use(require('markdown-it-plantuml'), '', {
147147
generateSource: function (umlCode) {
148+
const stripTrailingSlash = (url) => url.endsWith('/') ? url.slice(0, -1) : url
149+
const serverAddress = stripTrailingSlash(config.preview.plantUMLServerAddress) + '/svg'
148150
const s = unescape(encodeURIComponent(umlCode))
149151
const zippedCode = deflate.encode64(
150152
deflate.zip_deflate(`@startuml\n${s}\n@enduml`, 9)
151153
)
152-
return `http://www.plantuml.com/plantuml/svg/${zippedCode}`
154+
return `${serverAddress}/${zippedCode}`
153155
}
154156
})
155157

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class UiTab extends React.Component {
9494
latexInlineClose: this.refs.previewLatexInlineClose.value,
9595
latexBlockOpen: this.refs.previewLatexBlockOpen.value,
9696
latexBlockClose: this.refs.previewLatexBlockClose.value,
97+
plantUMLServerAddress: this.refs.previewPlantUMLServerAddress.value,
9798
scrollPastEnd: this.refs.previewScrollPastEnd.checked,
9899
smartQuotes: this.refs.previewSmartQuotes.checked,
99100
sanitize: this.refs.previewSanitize.value
@@ -544,6 +545,19 @@ class UiTab extends React.Component {
544545
/>
545546
</div>
546547
</div>
548+
<div styleName='group-section'>
549+
<div styleName='group-section-label'>
550+
{i18n.__('PlantUML Server')}
551+
</div>
552+
<div styleName='group-section-control'>
553+
<input styleName='group-section-control-input'
554+
ref='previewPlantUMLServerAddress'
555+
value={config.preview.plantUMLServerAddress}
556+
onChange={(e) => this.handleUIChange(e)}
557+
type='text'
558+
/>
559+
</div>
560+
</div>
547561

548562
<div styleName='group-control'>
549563
<button styleName='group-control-rightButton'

0 commit comments

Comments
 (0)