File tree 4 files changed +36
-4
lines changed
widgets/markdown_renderer
4 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,12 @@ tf_ts_library(
22
22
"@npm//@tensorflow/tfjs-core" ,
23
23
],
24
24
)
25
+
26
+ tf_ts_library (
27
+ name = "marked" ,
28
+ srcs = ["marked.ts" ],
29
+ deps = [
30
+ "@npm//@types/marked" ,
31
+ "@npm//marked" ,
32
+ ],
33
+ )
Original file line number Diff line number Diff line change
1
+ /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ ==============================================================================*/
15
+ /**
16
+ * @fileoverview This is an marked interop that papers over the differences
17
+ * within google internal repository and the external repository. Please depend
18
+ * on this module instead of depending on the marked directly.
19
+ */
20
+ import * as markedImport from 'marked' ;
21
+
22
+ // You cannot `export * from 'marked';` due to below error[1].
23
+ // [1]: 'marked' uses 'export =' and cannot be used with 'export *'.
24
+ export import marked = markedImport ;
Original file line number Diff line number Diff line change @@ -15,10 +15,9 @@ tf_ng_module(
15
15
"markdown_renderer_component.ng.html" ,
16
16
],
17
17
deps = [
18
+ "//tensorboard/webapp/third_party:marked" ,
18
19
"@npm//@angular/common" ,
19
20
"@npm//@angular/core" ,
20
- "@npm//@types/marked" ,
21
- "@npm//marked" ,
22
21
],
23
22
)
24
23
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
22
22
SimpleChanges ,
23
23
ViewEncapsulation ,
24
24
} from '@angular/core' ;
25
- import { parse } from 'marked' ;
25
+ import { marked } from '../../third_party/ marked' ;
26
26
27
27
@Component ( {
28
28
selector : 'markdown-renderer' ,
@@ -43,7 +43,7 @@ export class MarkdownRendererComponent implements OnChanges {
43
43
if ( changes [ 'markdown' ] ) {
44
44
const markdownChange : SimpleChange = changes [ 'markdown' ] ;
45
45
if ( markdownChange . previousValue !== this . markdown ) {
46
- this . markdownHTML = await parse ( this . markdown ) ;
46
+ this . markdownHTML = await marked . parse ( this . markdown ) ;
47
47
this . changeDetectorRef . detectChanges ( ) ;
48
48
}
49
49
}
You can’t perform that action at this time.
0 commit comments