File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 67
67
</ div >
68
68
< script >
69
69
const ConfigurationMdUrl = 'https://raw.githubusercontent.com/rust-lang/rustfmt/master/Configurations.md' ;
70
+ const UrlHash = window . location . hash . replace ( / ^ # / , '' ) ;
70
71
new Vue ( {
71
72
el : '#app' ,
72
73
data ( ) {
73
74
const configurationDescriptions = [ ] ;
74
- configurationDescriptions . links = { }
75
+ configurationDescriptions . links = { } ;
75
76
return {
76
77
aboutHtml : '' ,
77
78
configurationAboutHtml : '' ,
78
- searchCondition : '' ,
79
+ searchCondition : UrlHash ,
79
80
configurationDescriptions,
80
81
shouldStable : false
81
82
}
102
103
return marked . parser ( ast ) ;
103
104
}
104
105
} ,
105
- mounted : async function ( ) {
106
+ created : async function ( ) {
106
107
const res = await axios . get ( ConfigurationMdUrl ) ;
107
108
const {
108
109
about,
112
113
this . aboutHtml = marked . parser ( about ) ;
113
114
this . configurationAboutHtml = marked . parser ( configurationAbout ) ;
114
115
this . configurationDescriptions = configurationDescriptions ;
116
+ } ,
117
+ mounted ( ) {
118
+ if ( UrlHash === '' ) return ;
119
+ const interval = setInterval ( ( ) => {
120
+ const target = document . querySelector ( `#${ UrlHash } ` ) ;
121
+ if ( target != null ) {
122
+ target . scrollIntoView ( true ) ;
123
+ clearInterval ( interval ) ;
124
+ }
125
+ } , 100 ) ;
115
126
}
116
127
} ) ;
117
128
const extractDepthOnes = ( ast ) => {
You can’t perform that action at this time.
0 commit comments