This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 6767 </ div >
6868 < script >
6969 const ConfigurationMdUrl = 'https://raw.githubusercontent.com/rust-lang/rustfmt/master/Configurations.md' ;
70+ const UrlHash = window . location . hash . replace ( / ^ # / , '' ) ;
7071 new Vue ( {
7172 el : '#app' ,
7273 data ( ) {
7374 const configurationDescriptions = [ ] ;
74- configurationDescriptions . links = { }
75+ configurationDescriptions . links = { } ;
7576 return {
7677 aboutHtml : '' ,
7778 configurationAboutHtml : '' ,
78- searchCondition : '' ,
79+ searchCondition : UrlHash ,
7980 configurationDescriptions,
8081 shouldStable : false
8182 }
102103 return marked . parser ( ast ) ;
103104 }
104105 } ,
105- mounted : async function ( ) {
106+ created : async function ( ) {
106107 const res = await axios . get ( ConfigurationMdUrl ) ;
107108 const {
108109 about,
112113 this . aboutHtml = marked . parser ( about ) ;
113114 this . configurationAboutHtml = marked . parser ( configurationAbout ) ;
114115 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 ) ;
115126 }
116127 } ) ;
117128 const extractDepthOnes = ( ast ) => {
You can’t perform that action at this time.
0 commit comments